﻿using System;
using System.Data;
using System.Data.SqlClient;
using System.Configuration;
using System.Collections;
using System.Web;
using System.Web.Security;
using System.Web.UI;
using System.Web.UI.WebControls;
using System.Web.UI.WebControls.WebParts;
using System.Web.UI.HtmlControls;
using DAL;
using CommontLibrary;
using System.Xml;
using System.Xml.Xsl;

public partial class UserControl_Reports_loadReportWeb : System.Web.UI.UserControl
{
    DAHocVien objHocVien;
    DANguoidung objNguoidung;
    DataTable m_dt_nguoi_dung;
    protected void Page_Load(object sender, EventArgs e)
    {
        loadDataAccess();
        if (!Page.IsPostBack)
        {
            load_nhom_tvts();
            if(m_cbo_nhom_tvts.SelectedIndex != 0)
                load_tvts(Int32.Parse(m_cbo_nhom_tvts.SelectedValue));
            loadReport(0);
        }
    }
    private void loadDataAccess()
    {
        SqlConnection sqlConnec = ConnectData.getConnection();
        objHocVien = new DAHocVien(sqlConnec);
        objNguoidung = new DANguoidung(sqlConnec);
    }
    private void load_tvts(int ip_i_nhom_nguoi_dung_id)
    {
        m_cbo_tvts.Items.Clear();
        m_cbo_tvts.Items.Add(new ListItem("Tất cả", "0"));
        //if (ip_i_nhom_nguoi_dung_id == 0) return;
        m_dt_nguoi_dung = objNguoidung.loadQuyenNguoiDungCapDuoiByNguoiDungCapTrenVaTvts(ip_i_nhom_nguoi_dung_id,0).Tables[0];
        for (int v_i = 0; v_i < m_dt_nguoi_dung.Rows.Count; v_i++)
        {
            m_cbo_tvts.Items.Add(new ListItem(m_dt_nguoi_dung.Rows[v_i]["HoTen"].ToString(), m_dt_nguoi_dung.Rows[v_i]["ID"].ToString()));
        }
        
        int v_i_nguoi_dung_id = Convert.ToInt32(Session["UserID"]);
        int v_i_quyen = 0;
        if (is_nguoi_dung_quyen_tvts(v_i_nguoi_dung_id, ref v_i_quyen))
        {
            // set combobox là TVTS đó
            m_cbo_tvts.SelectedValue = v_i_nguoi_dung_id.ToString();
            m_cbo_tvts.Enabled = false;

            m_cbo_nhom_tvts.Enabled = false;
        }
    }
    private bool is_nguoi_dung_quyen_tvts(int ip_i_nguoi_dung_id, ref int op_i_quyen_cap_tren)
    {
        DataTable v_dt_quyen_ng_dung = new DataTable();

        v_dt_quyen_ng_dung = objNguoidung.loadQuyenByNguoiDung(ip_i_nguoi_dung_id).Tables[0];
        op_i_quyen_cap_tren = int.Parse(v_dt_quyen_ng_dung.Rows[0]["NguoiDungCapTrenID"].ToString());
        // Nhóm id của TVTS
        if (v_dt_quyen_ng_dung.Rows[0]["NhomID"].ToString().Equals("4")) return true;
        return false;
    }
    private int get_nhom_id_nguoi_dung(int ip_i_nguoi_dung_id, ref int op_i_quyen_cap_tren)
    {
        int v_i_nhom_id = 0;
        DataTable v_dt_quyen_ng_dung = new DataTable();
        v_dt_quyen_ng_dung = objNguoidung.loadQuyenByNguoiDung(ip_i_nguoi_dung_id).Tables[0];
        op_i_quyen_cap_tren = int.Parse(v_dt_quyen_ng_dung.Rows[0]["NguoiDungCapTrenID"].ToString());
        v_i_nhom_id = Convert.ToInt32(v_dt_quyen_ng_dung.Rows[0]["NhomID"]);
        return v_i_nhom_id;
    }
    private void load_nhom_tvts()
    {
        DataTable v_dt_nhom_nguoi_dung = new DataTable();
        v_dt_nhom_nguoi_dung = objNguoidung.loadQuyenNguoiDungByQuyen(4, 0).Tables[0];
        m_cbo_nhom_tvts.Items.Add(new ListItem("Tất cả", "0"));
        for (int v_i = 0; v_i < v_dt_nhom_nguoi_dung.Rows.Count; v_i++)
        {
            m_cbo_nhom_tvts.Items.Add(new ListItem(v_dt_nhom_nguoi_dung.Rows[v_i]["HoTen"].ToString(), v_dt_nhom_nguoi_dung.Rows[v_i]["ID"].ToString()));
        }

        int v_i_nguoi_dung_id = Convert.ToInt32(Session["UserID"]);
        int v_i_quyen_cap_tren = 0;
        int v_i_nhom_id = 0;
        v_i_nhom_id = get_nhom_id_nguoi_dung(v_i_nguoi_dung_id, ref v_i_quyen_cap_tren);
        if(v_i_nhom_id == 4)
        {
            m_cbo_nhom_tvts.SelectedValue = v_i_quyen_cap_tren.ToString();
        }
            // Nếu là trưởng nhóm
        else if (v_i_nhom_id == 1)
        {
            m_cbo_nhom_tvts.SelectedValue = v_i_nguoi_dung_id.ToString();
            m_cbo_nhom_tvts.Enabled = false;
        }
    }
    protected void callbackFileVideo_Callback(object sender, ComponentArt.Web.UI.CallBackEventArgs e)
    {
        // Thread.Sleep simulates the experience of accessing a remote server 
        // Remove before going to production 
        System.Threading.Thread.Sleep(250);
        loadReport_CallBack(Convert.ToInt32(e.Parameter),Int32.Parse(e.Parameters[1]), Convert.ToDateTime(e.Parameters[2]),Convert.ToDateTime(e.Parameters[3]), Convert.ToDateTime(e.Parameters[4]), Convert.ToDateTime(e.Parameters[5]));
        PlaceHolder1.RenderControl(e.Output);
    }
    public void loadReportExportExcel(DataTable dt)
    {
        string strStartDate = "01/01/1900";
        string strEndDate = "01/01/1900";
        DateTime dtmStartDate = DateTime.Now;
        DateTime dtmEndDate = DateTime.Now;
        DataTable dtData;  
        string strExcelFile="";
        DataSet dsData = new DataSet();
        XmlDataDocument XMLDoc;
        XmlNode XmlNode1;
        XmlNode XmlNode2;
        string strNode= "";
        ExportToExcel.ExcelExport objExport = new ExportToExcel.ExcelExport();
        objExport.TempFolder = "\\Excel\\Temp\\";
        objExport.TemplateFolder = "\\Excel\\Template\\";
        objExport.XSLStyleSheetFolder = "\\Excel\\XSLStyleSheet\\";
        objExport.CleanUpTemporaryFiles();
        try
        {
            strExcelFile = objExport.TransformDataTableToExcel(dt, true);
            objExport.SendExcelToClient(strExcelFile);
        }
        catch
        {

        }
    }

    public void loadReport_CallBack(int Check
                                    , int ip_i_id_tvts
                                   , DateTime ip_dat_nhap_tu_ngay
                                    , DateTime ip_dat_nhap_den_ngay
                                    , DateTime ip_dat_goi_tu_ngay
                                    , DateTime ip_dat_goi_den_ngay)
    {
        try
        {
            if (Check == 0)
            {
                this.ltReport.Text = loadReport1A_callBack(ip_i_id_tvts, ip_dat_nhap_tu_ngay, ip_dat_nhap_den_ngay
                                                            , ip_dat_goi_tu_ngay, ip_dat_goi_den_ngay);
                this.ltReport2.Text = loadReport2A_callBack(ip_i_id_tvts, ip_dat_nhap_tu_ngay, ip_dat_nhap_den_ngay
                                                            , ip_dat_goi_tu_ngay, ip_dat_goi_den_ngay);
                this.trReport1.Visible = true;
                this.trReport2.Visible = true;
            }
            else if (Check == 1)
            {
                this.ltReport.Text = loadReport1A_callBack(ip_i_id_tvts, ip_dat_nhap_tu_ngay, ip_dat_nhap_den_ngay
                                                            , ip_dat_goi_tu_ngay, ip_dat_goi_den_ngay);
                this.trReport1.Visible = true;
                this.trReport2.Visible = false;
            }
            else if (Check == 2)
            {
                this.ltReport2.Text = loadReport2A_callBack(ip_i_id_tvts, ip_dat_nhap_tu_ngay, ip_dat_nhap_den_ngay
                                                            , ip_dat_goi_tu_ngay, ip_dat_goi_den_ngay);
                this.trReport1.Visible = false;
                this.trReport2.Visible = true;
            }
        }
        catch
        {

        }
    }

    public void loadReport(int Check)
    {
        try
        {
            // Nếu chọn loại báo cáo là tất cả và TVTS là All thì chỉ load ra tổng
            if (Check == 0 && m_cbo_tvts.SelectedValue.Equals("0") && m_cbo_nhom_tvts.SelectedValue.Equals("0"))
            {
                this.ltReport.Text = loadReport1A_All();
                this.ltReport2.Text = loadReport2A_All();
                this.trReport1.Visible = true;
                this.trReport2.Visible = true;
            }
            // Nếu có chọn TVTS
            else
            {
                if (Check == 0)
                {
                    this.ltReport.Text = loadReport1A();
                    this.ltReport2.Text = loadReport2A();
                    this.trReport1.Visible = true;
                    this.trReport2.Visible = true;
                }
                else if (Check == 1)
                {
                    this.ltReport.Text = loadReport1A();
                    this.trReport1.Visible = true;
                    this.trReport2.Visible = false;
                }
                else if (Check == 2)
                {
                    this.ltReport2.Text = loadReport2A();
                    this.trReport1.Visible = false;
                    this.trReport2.Visible = true;
                }
            }
        }
        catch
        {

        }
    }
    // Cái này load theo nhóm và tvts
    public string loadReport1A()
    {
        try
        {
            DateTime v_dat_nhap_tu_ngay, v_dat_nhap_den_ngay, v_dat_goi_tu_ngay, v_dat_goi_den_ngay;
            if (this.m_dat_nhap_tu_ngay.SelectedDate != Convert.ToDateTime("01/01/0001"))
                v_dat_nhap_tu_ngay = this.m_dat_nhap_tu_ngay.SelectedDate;
            else v_dat_nhap_tu_ngay = Convert.ToDateTime("01/01/1900");

            if (this.m_dat_nhap_den_ngay.SelectedDate != Convert.ToDateTime("01/01/0001"))
                v_dat_nhap_den_ngay = this.m_dat_nhap_den_ngay.SelectedDate;
            else v_dat_nhap_den_ngay = Convert.ToDateTime("01/01/1900");

            if (this.m_dat_goi_tu_ngay.SelectedDate != Convert.ToDateTime("01/01/0001"))
                v_dat_goi_tu_ngay = this.m_dat_goi_tu_ngay.SelectedDate;
            else v_dat_goi_tu_ngay = Convert.ToDateTime("01/01/1900");

            if (this.m_dat_goi_den_ngay.SelectedDate != Convert.ToDateTime("01/01/0001"))
                v_dat_goi_den_ngay = this.m_dat_goi_den_ngay.SelectedDate;
            else v_dat_goi_den_ngay = Convert.ToDateTime("01/01/1900");

            int v_i_id_nhom_tvts = Int32.Parse(m_cbo_nhom_tvts.SelectedValue);
            int v_i_id_tvts = Int32.Parse(m_cbo_tvts.SelectedValue);
            string strHTML = "";
            strHTML += "\n <table width=\"100%\" align=\"center\" border=\"0\" >";
            strHTML += "\n     <tr>";
            strHTML += "\n          <td align=\"center\" ><span class=\"cssTitleReport2\">Báo cáo thông tin Ngành học trên Bằng cấp</span></td>";
            strHTML += "\n     </tr>";
            strHTML += "\n    <tr>";
            strHTML += "\n         <td align=\"center\" >";
            strHTML += "\n<table cellspacing=\"0\" cellpadding=\"0\" rules=\"all\" border=\"1\" style=\"width:850px;border-collapse:collapse;text-align:center;\"> ";
            strHTML += "\n    <tr class=\"cssGridHeader\"> ";
            strHTML += "\n        <td align=\"center\" style=\"width:10%;\"><span class=\"cssTitleReport\">Nhóm</span></td> ";
            strHTML += "\n        <td align=\"center\" style=\"width:10%;\"><span class=\"cssTitleReport\">TVTS</span></td> ";
            strHTML += "\n        <td align=\"center\" style=\"width:40%;\" ><span class=\"cssTitleReport\">Ngành học \\ Bằng cấp</span></td> ";
            strHTML += "\n        <td align=\"center\" style=\"width:8%;\"><span class=\"cssTitleReport\">Đại học</span></td> ";
            strHTML += "\n        <td align=\"center\" style=\"width:8%;\"><span class=\"cssTitleReport\">Cao Đẳng</span></td> ";
            strHTML += "\n        <td align=\"center\" style=\"width:8%;\"><span class=\"cssTitleReport\">Trung cấp</span></td> ";
            strHTML += "\n        <td align=\"center\" style=\"width:8%;\"><span class=\"cssTitleReport\">PTTH</span></td> ";
            strHTML += "\n        <td align=\"center\" style=\"width:8%;\"><span class=\"cssTitleReport\">Khác</span></td> ";
            strHTML += "\n    </tr> ";
            // Hết đoạn header

            // Bắt đầu đoạn load nhóm TVTS
            loadQuyenNhom_report1(ref strHTML, 4
                                 , v_dat_nhap_tu_ngay, v_dat_nhap_den_ngay
                                 , v_dat_goi_tu_ngay, v_dat_goi_den_ngay
                                 , v_i_id_tvts, v_i_id_nhom_tvts);
            strHTML += "\n</table>	    ";
            strHTML += "\n</td></tr>";
            strHTML += "\n</table>	    ";
            return strHTML;
        }
        catch
        {
            return "";
        }
    }
    public string loadReport1A_All()
    {
        try
        {
            DateTime v_dat_nhap_tu_ngay, v_dat_nhap_den_ngay, v_dat_goi_tu_ngay, v_dat_goi_den_ngay;
            if (this.m_dat_nhap_tu_ngay.SelectedDate != Convert.ToDateTime("01/01/0001"))
                v_dat_nhap_tu_ngay = this.m_dat_nhap_tu_ngay.SelectedDate;
            else v_dat_nhap_tu_ngay = Convert.ToDateTime("01/01/1900");

            if (this.m_dat_nhap_den_ngay.SelectedDate != Convert.ToDateTime("01/01/0001"))
                v_dat_nhap_den_ngay = this.m_dat_nhap_den_ngay.SelectedDate;
            else v_dat_nhap_den_ngay = Convert.ToDateTime("01/01/1900");

            if (this.m_dat_goi_tu_ngay.SelectedDate != Convert.ToDateTime("01/01/0001"))
                v_dat_goi_tu_ngay = this.m_dat_goi_tu_ngay.SelectedDate;
            else v_dat_goi_tu_ngay = Convert.ToDateTime("01/01/1900");

            if (this.m_dat_goi_den_ngay.SelectedDate != Convert.ToDateTime("01/01/0001"))
                v_dat_goi_den_ngay = this.m_dat_goi_den_ngay.SelectedDate;
            else v_dat_goi_den_ngay = Convert.ToDateTime("01/01/1900");

            int v_i_id_tvts = Int32.Parse(m_cbo_tvts.SelectedValue);

            DataRow dr = objHocVien.loadReportOneA(v_dat_nhap_tu_ngay
                                                  , v_dat_nhap_den_ngay
                                                  , v_dat_goi_tu_ngay
                                                  , v_dat_goi_den_ngay
                                                  , v_i_id_tvts);
            int intDH_All = Convert.ToInt32(dr["DH_QTKD"].ToString()) + Convert.ToInt32(dr["DH_KT"].ToString()) +
              Convert.ToInt32(dr["DH_THUD"].ToString()) + Convert.ToInt32(dr["DH_TCNH"].ToString());
            int intCD_All = Convert.ToInt32(dr["CD_QTKD"].ToString()) + Convert.ToInt32(dr["CD_KT"].ToString()) +
                Convert.ToInt32(dr["CD_THUD"].ToString()) + Convert.ToInt32(dr["CD_TCNH"].ToString());
            int intTC_All = Convert.ToInt32(dr["TC_QTKD"].ToString()) + Convert.ToInt32(dr["TC_KT"].ToString()) +
                Convert.ToInt32(dr["TC_THUD"].ToString()) + Convert.ToInt32(dr["TC_TCNH"].ToString());
            int intPTTH_All = Convert.ToInt32(dr["PTTH_QTKD"].ToString()) + Convert.ToInt32(dr["PTTH_KT"].ToString()) +
                Convert.ToInt32(dr["PTTH_THUD"].ToString()) + Convert.ToInt32(dr["PTTH_TCNH"].ToString());
            int intKHAC_All = Convert.ToInt32(dr["KHAC_QTKD"].ToString()) + Convert.ToInt32(dr["KHAC_KT"].ToString()) +
                Convert.ToInt32(dr["KHAC_THUD"].ToString()) + Convert.ToInt32(dr["KHAC_TCNH"].ToString());
            string strHTML = "";
            strHTML += "\n <table width=\"100%\" align=\"center\" border=\"0\" >";
            strHTML += "\n     <tr>";
            strHTML += "\n          <td align=\"center\" ><span class=\"cssTitleReport2\">Báo cáo thông tin Ngành học trên Bằng cấp</span></td>";
            strHTML += "\n     </tr>";
            strHTML += "\n    <tr>";
            strHTML += "\n         <td align=\"center\" >";
            strHTML += "\n<table cellspacing=\"0\" cellpadding=\"0\" rules=\"all\" border=\"1\" style=\"width:778px;border-collapse:collapse;text-align:center;\"> ";
            strHTML += "\n    <tr class=\"cssGridHeader\"> ";
            //strHTML += "\n        <td align=\"center\" style=\"width:10%;\"><span class=\"cssTitleReport\">Nhóm</span></td> ";
            //strHTML += "\n        <td align=\"center\" style=\"width:10%;\"><span class=\"cssTitleReport\">TVTS</span></td> ";
            strHTML += "\n        <td align=\"center\" style=\"width:50%;\" ><span class=\"cssTitleReport\">Ngành học \\ Bằng cấp</span></td> ";
            strHTML += "\n        <td align=\"center\" style=\"width:10%;\"><span class=\"cssTitleReport\">Đại học</span></td> ";
            strHTML += "\n        <td align=\"center\" style=\"width:10%;\"><span class=\"cssTitleReport\">Cao Đẳng</span></td> ";
            strHTML += "\n        <td align=\"center\" style=\"width:10%;\"><span class=\"cssTitleReport\">Trung cấp</span></td> ";
            strHTML += "\n        <td align=\"center\" style=\"width:10%;\"><span class=\"cssTitleReport\">PTTH</span></td> ";
            strHTML += "\n        <td align=\"center\" style=\"width:10%;\"><span class=\"cssTitleReport\">Khác</span></td> ";
            strHTML += "\n    </tr> ";

            // Hết đoạn header

            // Bắt đầu đoạn load tên nhóm và tên tvts và dữ liệu từng tvts
            strHTML += "\n    <tr class=\"cssGridCell\"> ";
            strHTML += "\n        <td align=\"left\" style=\"padding-left:10px;\"><span class=\"cssTitleReport\">Ngành Quản trị kinh doanh</span></td> ";
            strHTML += "\n        <td><span class=\"cssLabel\">" + dr["DH_QTKD"].ToString() + "</span></td> ";
            strHTML += "\n        <td><span class=\"cssLabel\">" + dr["CD_QTKD"].ToString() + "</span></td> ";
            strHTML += "\n        <td><span class=\"cssLabel\">" + dr["TC_QTKD"].ToString() + "</span></td> ";
            strHTML += "\n        <td><span class=\"cssLabel\">" + dr["PTTH_QTKD"].ToString() + "</span></td> ";
            strHTML += "\n        <td><span class=\"cssLabel\">" + dr["KHAC_QTKD"].ToString() + "</span></td> ";
            strHTML += "\n    </tr>	 ";
            strHTML += "\n    <tr class=\"cssGridAlterCell\"> ";
            strHTML += "\n        <td align=\"left\" style=\"padding-left:10px;\"><span class=\"cssTitleReport\">Ngành Kế toàn</span></td> ";
            strHTML += "\n        <td><span class=\"cssLabel\">" + dr["DH_KT"].ToString() + "</span></td> ";
            strHTML += "\n        <td><span class=\"cssLabel\">" + dr["CD_KT"].ToString() + "</span></td> ";
            strHTML += "\n        <td><span class=\"cssLabel\">" + dr["TC_KT"].ToString() + "</span></td> ";
            strHTML += "\n        <td><span class=\"cssLabel\">" + dr["PTTH_KT"].ToString() + "</span></td> ";
            strHTML += "\n        <td><span class=\"cssLabel\">" + dr["KHAC_KT"].ToString() + "</span></td> ";
            strHTML += "\n    </tr>	 ";
            strHTML += "\n    <tr class=\"cssGridCell\"> ";
            strHTML += "\n        <td align=\"left\" style=\"padding-left:10px;\"><span class=\"cssTitleReport\">Ngành Tin học ứng dụng</span></td> ";
            strHTML += "\n        <td><span class=\"cssLabel\">" + dr["DH_THUD"].ToString() + "</span></td> ";
            strHTML += "\n        <td><span class=\"cssLabel\">" + dr["CD_THUD"].ToString() + "</span></td> ";
            strHTML += "\n        <td><span class=\"cssLabel\">" + dr["TC_THUD"].ToString() + "</span></td> ";
            strHTML += "\n        <td><span class=\"cssLabel\">" + dr["PTTH_THUD"].ToString() + "</span></td> ";
            strHTML += "\n        <td><span class=\"cssLabel\">" + dr["KHAC_THUD"].ToString() + "</span></td> ";
            strHTML += "\n    </tr>		 ";
            strHTML += "\n    <tr class=\"cssGridAlterCell\"> ";
            strHTML += "\n        <td align=\"left\" style=\"padding-left:10px;\"><span class=\"cssTitleReport\">Ngành Tài chính ngân hàng</span></td> ";
            strHTML += "\n        <td><span class=\"cssLabel\">" + dr["DH_TCNH"].ToString() + "</span></td> ";
            strHTML += "\n        <td><span class=\"cssLabel\">" + dr["CD_TCNH"].ToString() + "</span></td> ";
            strHTML += "\n        <td><span class=\"cssLabel\">" + dr["TC_TCNH"].ToString() + "</span></td> ";
            strHTML += "\n        <td><span class=\"cssLabel\">" + dr["PTTH_TCNH"].ToString() + "</span></td> ";
            strHTML += "\n        <td><span class=\"cssLabel\">" + dr["KHAC_TCNH"].ToString() + "</span></td> ";
            strHTML += "\n    </tr>		 ";
            strHTML += "\n    <tr class=\"cssGridCell\"> ";
            strHTML += "\n        <td align=\"left\" style=\"padding-left:10px;\"><span class=\"cssTitleReport\">Tổng số Ngành học \\Bằng cấp</span></td> ";
            strHTML += "\n        <td><span class=\"cssLabel\">" + intDH_All.ToString() + "</span></td> ";
            strHTML += "\n        <td><span class=\"cssLabel\">" + intCD_All.ToString() + "</span></td> ";
            strHTML += "\n        <td><span class=\"cssLabel\">" + intTC_All.ToString() + "</span></td> ";
            strHTML += "\n        <td><span class=\"cssLabel\">" + intPTTH_All.ToString() + "</span></td> ";
            strHTML += "\n        <td><span class=\"cssLabel\">" + intKHAC_All.ToString() + "</span></td> ";
            strHTML += "\n    </tr>	 ";
            strHTML += "\n</table>	    ";
            strHTML += "\n   </td></tr>	 ";
            strHTML += "\n</table>	    ";
            return strHTML;
        }
        catch
        {
            return "";
        }
    }

    public void loadQuyenNhom_report1(ref string strTable, int intQuyenID
                                        , DateTime ip_dat_nhap_tu_ngay
                                        , DateTime ip_dat_nhap_den_ngay
                                        , DateTime ip_dat_goi_tu_ngay
                                        , DateTime ip_dat_goi_den_ngay
                                        , int ip_id_tvts
                                        , int ip_id_nhom_tvts)
    {
        DataSet dsNguoiDung = objNguoidung.loadQuyenNguoiDungByQuyen(intQuyenID, 0);
        if (dsNguoiDung != null && dsNguoiDung.Tables[0].Rows.Count > 0)
        {
            DataRow[] drNguoiDungV = dsNguoiDung.Tables[0].Select("ID <> 1 AND (ID =" + ip_id_nhom_tvts + " OR " + ip_id_nhom_tvts + " = 0)");
            foreach (DataRow dr in drNguoiDungV)
            {
                int intNguoiDungCapTren = Convert.ToInt32(dr["ID"].ToString());
                DataSet dsNguoiDungCapDuoi = objNguoidung.loadQuyenNguoiDungCapDuoiByNguoiDungCapTrenVaTvts(intNguoiDungCapTren, ip_id_tvts);
                if (dsNguoiDungCapDuoi != null && dsNguoiDungCapDuoi.Tables[0].Rows.Count > 0)
                {
                    strTable += "\n<tr>";
                    strTable += "\n<td class='cssTableReport'";
                    // Cái này hiển thị tên của trưởng nhóm
                    strTable += " rowspan='" + (dsNguoiDungCapDuoi.Tables[0].Rows.Count * 6).ToString() + "' >" + dr["HoTen"].ToString() + "</td>";
                    int i = 0;
                    // Cái này duyệt từng tvts trong nhóm đó
                    foreach (DataRow drNguoiDungCapDuoi in dsNguoiDungCapDuoi.Tables[0].Rows)
                    {
                        if (i != 0)
                        {
                            strTable += "\n<tr>";
                        }
                        i++;
                        // đóng td tên của tvts
                        strTable += "\n<td class='cssTableReport' rowspan='5'>" + drNguoiDungCapDuoi["HoTen"].ToString() + "</td>";
                        Load_chi_tiet_tung_tvts_report1(ref strTable, "&nbsp;", Convert.ToInt32(drNguoiDungCapDuoi["ID"].ToString()),
                            ip_dat_nhap_tu_ngay, ip_dat_nhap_den_ngay, ip_dat_goi_tu_ngay, ip_dat_goi_den_ngay);

                        strTable += "\n<tr>";
                        strTable += "\n<td style='height:20px;background-color:#C0C0C0;' colspan='24'></td>";
                        strTable += "\n</tr>";
                    }
                }
                //else
                //{
                //    strTable += ">" + dr["HoTen"].ToString() + "</td>";
                //    strTable += "\n<td class='cssReport23Title1'>TVTS</td>";
                //    strTable += "\n<td class='cssReport23Title1'>&nbsp;</td>";
                //    strTable += "\n<td class='cssReport23Title1'>L1</td>";
                //    strTable += "\n<td class='cssReport23Title1'>&nbsp;</td>";

                //    strTable += "\n<td class='cssReport23Title1'>L2</td>";
                //    strTable += "\n<td class='cssReport23Title1'>&nbsp;</td>";
                //    strTable += "\n<td class='cssReport23Title1'>L3</td>";
                //    strTable += "\n<td class='cssReport23Title1'>&nbsp;</td>";
                //    strTable += "\n<td class='cssReport23Title1'>L4</td>";
                //    strTable += "\n<td class='cssReport23Title1'>&nbsp;</td>";
                //    strTable += "\n<td class='cssReport23Title1'>L5A</td>";

                //    strTable += "\n<td class='cssReport23Title1'>&nbsp;</td>";
                //    strTable += "\n<td class='cssReport23Title1'>L5B</td>";
                //    strTable += "\n<td class='cssReport23Title1'>&nbsp;</td>";
                //    strTable += "\n<td class='cssReport23Title1'>L6</td>";
                //    strTable += "\n<td class='cssReport23Title1'>&nbsp;</td>";
                //    strTable += "\n<td class='cssReport23Title1'>L7</td>";
                //    strTable += "\n<td class='cssReport23Title1'>&nbsp;</td>";

                //    strTable += "\n<td class='cssReport23Title1'>L8B</td>";
                //    strTable += "\n<td class='cssReport23Title1'>&nbsp;</td>";
                //    strTable += "\n<td class='cssReport23Title1'>L8A</td>";
                //    strTable += "\n<td class='cssReport23Title1'>&nbsp;</td>";
                //    strTable += "\n<td class='cssReport23Title1'>L9</td>";
                //    strTable += "\n<td class='cssReport23Title1'>&nbsp;</td>";
                //    strTable += "\n</tr>";
                //}
            }
        }
    }

    public void loadQuyenNhom_report2(ref string strTable, int intQuyenID
                                        , DateTime ip_dat_nhap_tu_ngay
                                        , DateTime ip_dat_nhap_den_ngay
                                        , DateTime ip_dat_goi_tu_ngay
                                        , DateTime ip_dat_goi_den_ngay
                                        , int ip_id_tvts
                                        , int ip_id_nhom_tvts)
    {
        DataSet dsNguoiDung = objNguoidung.loadQuyenNguoiDungByQuyen(intQuyenID, 0);
        if (dsNguoiDung != null && dsNguoiDung.Tables[0].Rows.Count > 0)
        {
            DataRow[] drNguoiDungV = dsNguoiDung.Tables[0].Select("ID <> 1 AND (ID =" + ip_id_nhom_tvts + " OR " + ip_id_nhom_tvts + " = 0)");
            foreach (DataRow dr in drNguoiDungV)
            {
                int intNguoiDungCapTren = Convert.ToInt32(dr["ID"].ToString());
                DataSet dsNguoiDungCapDuoi = objNguoidung.loadQuyenNguoiDungCapDuoiByNguoiDungCapTrenVaTvts(intNguoiDungCapTren, ip_id_tvts);
                float ip_f_l21_trung_binh, ip_f_l32_trung_binh, ip_f_l43_trung_binh, ip_f_l5a4_trung_binh
                        , ip_f_l5b5a_trung_binh, ip_f_l65b_trung_binh, ip_f_l76_trung_binh, ip_f_l87_trung_binh;
                if (dsNguoiDungCapDuoi != null && dsNguoiDungCapDuoi.Tables[0].Rows.Count > 0)
                {
                    int v_i_so_tvts_trong_nhom = 0;
                    ip_f_l21_trung_binh = 0;
                    ip_f_l32_trung_binh = 0;
                    ip_f_l43_trung_binh = 0;
                    ip_f_l5a4_trung_binh = 0;
                    ip_f_l5b5a_trung_binh = 0;
                    ip_f_l65b_trung_binh = 0;
                    ip_f_l76_trung_binh = 0;
                    ip_f_l87_trung_binh = 0;
                    strTable += "\n<tr>";
                    strTable += "\n<td class='cssTableReport'";
                    // Cái này hiển thị tên của trưởng nhóm
                    strTable += " rowspan='" + (dsNguoiDungCapDuoi.Tables[0].Rows.Count * 3).ToString() + "' >" + dr["HoTen"].ToString() + "</td>";
                    int i = 0;
                    // Cái này duyệt từng tvts trong nhóm đó
                    foreach (DataRow drNguoiDungCapDuoi in dsNguoiDungCapDuoi.Tables[0].Rows)
                    {
                        if (i != 0)
                        {
                            strTable += "\n<tr>";
                        }
                        i++;
                        // đóng td tên của tvts
                        strTable += "\n<td class='cssTableReport' rowspan='2'>" + drNguoiDungCapDuoi["HoTen"].ToString() + "</td>";
                        Load_chi_tiet_tung_tvts_report2(ref strTable, "&nbsp;", Convert.ToInt32(drNguoiDungCapDuoi["ID"].ToString()),
                            ip_dat_nhap_tu_ngay, ip_dat_nhap_den_ngay, ip_dat_goi_tu_ngay, ip_dat_goi_den_ngay
                            , ref ip_f_l21_trung_binh
                            , ref ip_f_l32_trung_binh
                            , ref ip_f_l43_trung_binh
                            , ref ip_f_l5a4_trung_binh
                            , ref ip_f_l5b5a_trung_binh
                            , ref ip_f_l65b_trung_binh
                            , ref ip_f_l76_trung_binh
                            , ref ip_f_l87_trung_binh);

                        strTable += "\n<tr>";
                        strTable += "\n<td style='height:20px;background-color:#C0C0C0;' colspan='24'></td>";
                        strTable += "\n</tr>";
                    }
                    v_i_so_tvts_trong_nhom = dsNguoiDungCapDuoi.Tables[0].Rows.Count;
                    // Add thêm phần trung bình
                    strTable += "\n<tr>";
                    strTable += "\n<td class='cssTableReport' colspan='4'>Trung bình</td>";
                    strTable += "\n<td class='cssTableReport'>" + ip_f_l21_trung_binh / v_i_so_tvts_trong_nhom + "%</td>";
                    strTable += "\n<td class='cssTableReport'>" + ip_f_l32_trung_binh / v_i_so_tvts_trong_nhom + "%</td>";
                    strTable += "\n<td class='cssTableReport'>" + ip_f_l43_trung_binh / v_i_so_tvts_trong_nhom + "%</td>";
                    strTable += "\n<td class='cssTableReport'>" + ip_f_l5a4_trung_binh / v_i_so_tvts_trong_nhom + "%</td>";
                    strTable += "\n<td class='cssTableReport'>" + ip_f_l5b5a_trung_binh / v_i_so_tvts_trong_nhom + "%</td>";
                    strTable += "\n<td class='cssTableReport'>" + ip_f_l65b_trung_binh / v_i_so_tvts_trong_nhom + "%</td>";
                    strTable += "\n<td class='cssTableReport'>" + ip_f_l76_trung_binh / v_i_so_tvts_trong_nhom + "%</td>";
                    strTable += "\n<td class='cssTableReport'>" + ip_f_l87_trung_binh / v_i_so_tvts_trong_nhom + "%</td>";
                    strTable += "\n</tr>";
                }
                //else
                //{
                //    strTable += ">" + dr["HoTen"].ToString() + "</td>";
                //    strTable += "\n<td class='cssReport23Title1'>TVTS</td>";
                //    strTable += "\n<td class='cssReport23Title1'>&nbsp;</td>";
                //    strTable += "\n<td class='cssReport23Title1'>L1</td>";
                //    strTable += "\n<td class='cssReport23Title1'>&nbsp;</td>";

                //    strTable += "\n<td class='cssReport23Title1'>L2</td>";
                //    strTable += "\n<td class='cssReport23Title1'>&nbsp;</td>";
                //    strTable += "\n<td class='cssReport23Title1'>L3</td>";
                //    strTable += "\n<td class='cssReport23Title1'>&nbsp;</td>";
                //    strTable += "\n<td class='cssReport23Title1'>L4</td>";
                //    strTable += "\n<td class='cssReport23Title1'>&nbsp;</td>";
                //    strTable += "\n<td class='cssReport23Title1'>L5A</td>";

                //    strTable += "\n<td class='cssReport23Title1'>&nbsp;</td>";
                //    strTable += "\n<td class='cssReport23Title1'>L5B</td>";
                //    strTable += "\n<td class='cssReport23Title1'>&nbsp;</td>";
                //    strTable += "\n<td class='cssReport23Title1'>L6</td>";
                //    strTable += "\n<td class='cssReport23Title1'>&nbsp;</td>";
                //    strTable += "\n<td class='cssReport23Title1'>L7</td>";
                //    strTable += "\n<td class='cssReport23Title1'>&nbsp;</td>";

                //    strTable += "\n<td class='cssReport23Title1'>L8B</td>";
                //    strTable += "\n<td class='cssReport23Title1'>&nbsp;</td>";
                //    strTable += "\n<td class='cssReport23Title1'>L8A</td>";
                //    strTable += "\n<td class='cssReport23Title1'>&nbsp;</td>";
                //    strTable += "\n<td class='cssReport23Title1'>L9</td>";
                //    strTable += "\n<td class='cssReport23Title1'>&nbsp;</td>";
                //    strTable += "\n</tr>";
                //}
            }
        }
    }
    public void Load_chi_tiet_tung_tvts_report1(ref string strHTML, string strText, int intNguoiDungID
                                        , DateTime ip_dat_nhap_tu_ngay
                                        , DateTime ip_dat_nhap_den_ngay
                                        , DateTime ip_dat_goi_tu_ngay
                                        , DateTime ip_dat_goi_den_ngay)
    {
        // Cái này sẽ là load của từng TVTS
        DataRow dr = objHocVien.loadReportOneA(ip_dat_nhap_tu_ngay
                                              , ip_dat_nhap_den_ngay
                                              , ip_dat_goi_tu_ngay
                                              , ip_dat_goi_den_ngay
                                              , intNguoiDungID);
        int intDH_All = Convert.ToInt32(dr["DH_QTKD"].ToString()) + Convert.ToInt32(dr["DH_KT"].ToString()) +
          Convert.ToInt32(dr["DH_THUD"].ToString()) + Convert.ToInt32(dr["DH_TCNH"].ToString());
        int intCD_All = Convert.ToInt32(dr["CD_QTKD"].ToString()) + Convert.ToInt32(dr["CD_KT"].ToString()) +
            Convert.ToInt32(dr["CD_THUD"].ToString()) + Convert.ToInt32(dr["CD_TCNH"].ToString());
        int intTC_All = Convert.ToInt32(dr["TC_QTKD"].ToString()) + Convert.ToInt32(dr["TC_KT"].ToString()) +
            Convert.ToInt32(dr["TC_THUD"].ToString()) + Convert.ToInt32(dr["TC_TCNH"].ToString());
        int intPTTH_All = Convert.ToInt32(dr["PTTH_QTKD"].ToString()) + Convert.ToInt32(dr["PTTH_KT"].ToString()) +
            Convert.ToInt32(dr["PTTH_THUD"].ToString()) + Convert.ToInt32(dr["PTTH_TCNH"].ToString());
        int intKHAC_All = Convert.ToInt32(dr["KHAC_QTKD"].ToString()) + Convert.ToInt32(dr["KHAC_KT"].ToString()) +
            Convert.ToInt32(dr["KHAC_THUD"].ToString()) + Convert.ToInt32(dr["KHAC_TCNH"].ToString());
        // Bắt đầu đoạn load tên nhóm và tên tvts và dữ liệu từng tvts
      //  strHTML += "\n    <tr class=\"cssGridCell\"> ";
        strHTML += "\n        <td align=\"left\" style=\"padding-left:10px;\"><span class=\"cssTitleReport\">Ngành Quản trị kinh doanh</span></td> ";
        strHTML += "\n        <td><span class=\"cssLabel\">" + dr["DH_QTKD"].ToString() + "</span></td> ";
        strHTML += "\n        <td><span class=\"cssLabel\">" + dr["CD_QTKD"].ToString() + "</span></td> ";
        strHTML += "\n        <td><span class=\"cssLabel\">" + dr["TC_QTKD"].ToString() + "</span></td> ";
        strHTML += "\n        <td><span class=\"cssLabel\">" + dr["PTTH_QTKD"].ToString() + "</span></td> ";
        strHTML += "\n        <td><span class=\"cssLabel\">" + dr["KHAC_QTKD"].ToString() + "</span></td> ";
        strHTML += "\n    </tr>	 ";

        strHTML += "\n    <tr class=\"cssGridAlterCell\"> ";
        strHTML += "\n        <td align=\"left\" style=\"padding-left:10px;\"><span class=\"cssTitleReport\">Ngành Kế toán</span></td> ";
        strHTML += "\n        <td><span class=\"cssLabel\">" + dr["DH_KT"].ToString() + "</span></td> ";
        strHTML += "\n        <td><span class=\"cssLabel\">" + dr["CD_KT"].ToString() + "</span></td> ";
        strHTML += "\n        <td><span class=\"cssLabel\">" + dr["TC_KT"].ToString() + "</span></td> ";
        strHTML += "\n        <td><span class=\"cssLabel\">" + dr["PTTH_KT"].ToString() + "</span></td> ";
        strHTML += "\n        <td><span class=\"cssLabel\">" + dr["KHAC_KT"].ToString() + "</span></td> ";
        strHTML += "\n    </tr>	 ";

        strHTML += "\n    <tr class=\"cssGridCell\"> ";
        strHTML += "\n        <td align=\"left\" style=\"padding-left:10px;\"><span class=\"cssTitleReport\">Ngành Tin học ứng dụng</span></td> ";
        strHTML += "\n        <td><span class=\"cssLabel\">" + dr["DH_THUD"].ToString() + "</span></td> ";
        strHTML += "\n        <td><span class=\"cssLabel\">" + dr["CD_THUD"].ToString() + "</span></td> ";
        strHTML += "\n        <td><span class=\"cssLabel\">" + dr["TC_THUD"].ToString() + "</span></td> ";
        strHTML += "\n        <td><span class=\"cssLabel\">" + dr["PTTH_THUD"].ToString() + "</span></td> ";
        strHTML += "\n        <td><span class=\"cssLabel\">" + dr["KHAC_THUD"].ToString() + "</span></td> ";
        strHTML += "\n    </tr>		 ";

        strHTML += "\n    <tr class=\"cssGridAlterCell\"> ";
        strHTML += "\n        <td align=\"left\" style=\"padding-left:10px;\"><span class=\"cssTitleReport\">Ngành Tài chính ngân hàng</span></td> ";
        strHTML += "\n        <td><span class=\"cssLabel\">" + dr["DH_TCNH"].ToString() + "</span></td> ";
        strHTML += "\n        <td><span class=\"cssLabel\">" + dr["CD_TCNH"].ToString() + "</span></td> ";
        strHTML += "\n        <td><span class=\"cssLabel\">" + dr["TC_TCNH"].ToString() + "</span></td> ";
        strHTML += "\n        <td><span class=\"cssLabel\">" + dr["PTTH_TCNH"].ToString() + "</span></td> ";
        strHTML += "\n        <td><span class=\"cssLabel\">" + dr["KHAC_TCNH"].ToString() + "</span></td> ";
        strHTML += "\n    </tr>		 ";

        strHTML += "\n    <tr class=\"cssGridCell\"> ";
        strHTML += "\n        <td align=\"left\" style=\"padding-left:10px;\"><span class=\"cssTitleReport\">Tổng số Ngành học \\Bằng cấp</span></td> ";
        strHTML += "\n        <td><span class=\"cssLabel\">" + intDH_All.ToString() + "</span></td> ";
        strHTML += "\n        <td><span class=\"cssLabel\">" + intCD_All.ToString() + "</span></td> ";
        strHTML += "\n        <td><span class=\"cssLabel\">" + intTC_All.ToString() + "</span></td> ";
        strHTML += "\n        <td><span class=\"cssLabel\">" + intPTTH_All.ToString() + "</span></td> ";
        strHTML += "\n        <td><span class=\"cssLabel\">" + intKHAC_All.ToString() + "</span></td> ";
        strHTML += "\n    </tr>	 ";
    }

    private void Load_chi_tiet_tung_tvts_report2(ref string strHTML, string strText, int intNguoiDungID
                                       , DateTime ip_dat_nhap_tu_ngay
                                       , DateTime ip_dat_nhap_den_ngay
                                       , DateTime ip_dat_goi_tu_ngay
                                       , DateTime ip_dat_goi_den_ngay
                                       , ref float ip_f_l21_trung_binh
                                       , ref float ip_f_l32_trung_binh
                                        , ref float ip_f_l43_trung_binh
                                        , ref float ip_f_l5a4_trung_binh
                                        , ref float ip_f_l5b5a_trung_binh
                                        , ref float ip_f_l65b_trung_binh
                                        , ref float ip_f_l76_trung_binh
                                        , ref float ip_f_l87_trung_binh)
    {
        DataRow dr = objHocVien.loadReportTwoA(ip_dat_nhap_tu_ngay
                                              , ip_dat_nhap_den_ngay
                                              , ip_dat_goi_tu_ngay
                                              , ip_dat_goi_den_ngay
                                              , intNguoiDungID);
        //DataRow dr = objHocVien.loadReport2();
        float intL21 = 0;
        int intL32 = 0;
        int intL43 = 0;
        int intL5A4 = 0;
        int intL5B5A = 0;
        int intL65B = 0;
        int intL76 = 0;
        int intL87 = 0;
        if (!dr["Level1"].ToString().Trim().Equals("0"))
        {
            intL21 = (Convert.ToInt32(dr["Level2"]) * 100) / Convert.ToInt32(dr["Level1"]);
            ip_f_l21_trung_binh += intL21;
        }
        if (!dr["Level2"].ToString().Trim().Equals("0"))
        {
            intL32 = (Convert.ToInt32(dr["Level3"]) * 100) / Convert.ToInt32(dr["Level2"]);
            ip_f_l32_trung_binh += intL32;
        }
        if (!dr["Level3"].ToString().Trim().Equals("0"))
        {
            intL43 = (Convert.ToInt32(dr["Level4"]) * 100) / Convert.ToInt32(dr["Level3"]);
            ip_f_l43_trung_binh += intL43;
        }
        if (!dr["Level4"].ToString().Trim().Equals("0"))
        {
            intL5A4 = (Convert.ToInt32(dr["Level5A"]) * 100) / Convert.ToInt32(dr["Level4"]);
            ip_f_l5a4_trung_binh += intL5A4;
        }
        if (!dr["Level5A"].ToString().Trim().Equals("0"))
        {
            intL5B5A = (Convert.ToInt32(dr["Level5B"]) * 100) / Convert.ToInt32(dr["Level5A"]);
            ip_f_l5b5a_trung_binh += intL5B5A;
        }
        if (!dr["Level5B"].ToString().Trim().Equals("0"))
        {
            intL65B = (Convert.ToInt32(dr["Level6"]) * 100) / Convert.ToInt32(dr["Level5B"]);
            ip_f_l65b_trung_binh += intL65B;
        }
        if (!dr["Level6"].ToString().Trim().Equals("0"))
        {
            intL76 = (Convert.ToInt32(dr["Level7"]) * 100) / Convert.ToInt32(dr["Level6"]);
            ip_f_l76_trung_binh += intL76;
        }
        if (!dr["Level7"].ToString().Trim().Equals("0"))
        {
            intL87 = (Convert.ToInt32(dr["Level8"]) * 100) / Convert.ToInt32(dr["Level7"]);
            ip_f_l87_trung_binh += intL87;
        }

        strHTML += "\n                        <td align=\"left\" style=\"padding-left:10px;\"><span class=\"cssTitleReport\">LX/LY (%)</span></td>";
        strHTML += "\n                        <td align=\"center\" ><span class=\"cssLabel\">100%</span></td>";
        strHTML += "\n                        <td align=\"center\" ><span class=\"cssLabel\">" + intL21.ToString() + "%</span></td>";
        strHTML += "\n                        <td align=\"center\" ><span class=\"cssLabel\">" + intL32.ToString() + "%</span></td>";
        strHTML += "\n                        <td align=\"center\" ><span class=\"cssLabel\">" + intL43.ToString() + "%</span></td>";
        strHTML += "\n                        <td align=\"center\" ><span class=\"cssLabel\">" + intL5A4.ToString() + "%</span></td>";
        strHTML += "\n                        <td align=\"center\" ><span class=\"cssLabel\">" + intL5B5A.ToString() + "%</span></td>";
        strHTML += "\n                        <td align=\"center\" ><span class=\"cssLabel\">" + intL65B.ToString() + "%</span></td>";
        strHTML += "\n                        <td align=\"center\" ><span class=\"cssLabel\">" + intL76.ToString() + "%</span></td>";
        strHTML += "\n                        <td align=\"center\" ><span class=\"cssLabel\">" + intL87.ToString() + "%</span></td>";
        strHTML += "\n                    </tr>";
        strHTML += "\n                    <tr class=\"cssGridAlterCell\">";
        strHTML += "\n                        <td align=\"left\" style=\"padding-left:10px;\"><span class=\"cssTitleReport\">Số lượng LX (Học sinh)</span></td>";
        strHTML += "\n                        <td align=\"center\" ><span class=\"cssLabel\">" + dr["Level1"].ToString() + "</span></td>";
        strHTML += "\n                        <td align=\"center\" ><span class=\"cssLabel\">" + dr["Level2"].ToString() + "</span></td>";
        strHTML += "\n                        <td align=\"center\" ><span class=\"cssLabel\">" + dr["Level3"].ToString() + "</span></td>";
        strHTML += "\n                        <td align=\"center\" ><span class=\"cssLabel\">" + dr["Level4"].ToString() + "</span></td>";
        strHTML += "\n                        <td align=\"center\" ><span class=\"cssLabel\">" + dr["Level5a"].ToString() + "</span></td>";
        strHTML += "\n                        <td align=\"center\" ><span class=\"cssLabel\">" + dr["Level5b"].ToString() + "</span></td>";
        strHTML += "\n                        <td align=\"center\" ><span class=\"cssLabel\">" + dr["Level6"].ToString() + "</span></td>";
        strHTML += "\n                        <td align=\"center\" ><span class=\"cssLabel\">" + dr["Level7"].ToString() + "</span></td>";
        strHTML += "\n                        <td align=\"center\" ><span class=\"cssLabel\">" + dr["Level8"].ToString() + "</span></td>";
        strHTML += "\n                    </tr>";
    }
    private string loadReport1A_callBack(int ip_i_id_tvts
                                    , DateTime ip_dat_nhap_tu_ngay
                                       , DateTime ip_dat_nhap_den_ngay
                                       , DateTime ip_dat_goi_tu_ngay
                                       , DateTime ip_dat_goi_den_ngay)
    {
        try
        {
            DataRow dr = objHocVien.loadReportOneA(ip_dat_nhap_tu_ngay
                                                  , ip_dat_nhap_den_ngay
                                                  , ip_dat_goi_tu_ngay
                                                  , ip_dat_goi_den_ngay
                                                  , ip_i_id_tvts);
            int intDH_All = Convert.ToInt32(dr["DH_QTKD"].ToString()) + Convert.ToInt32(dr["DH_KT"].ToString()) +
              Convert.ToInt32(dr["DH_THUD"].ToString()) + Convert.ToInt32(dr["DH_TCNH"].ToString());
            int intCD_All = Convert.ToInt32(dr["CD_QTKD"].ToString()) + Convert.ToInt32(dr["CD_KT"].ToString()) +
                Convert.ToInt32(dr["CD_THUD"].ToString()) + Convert.ToInt32(dr["CD_TCNH"].ToString());
            int intTC_All = Convert.ToInt32(dr["TC_QTKD"].ToString()) + Convert.ToInt32(dr["TC_QTKD"].ToString()) +
                Convert.ToInt32(dr["TC_THUD"].ToString()) + Convert.ToInt32(dr["TC_TCNH"].ToString());
            int intPTTH_All = Convert.ToInt32(dr["PTTH_QTKD"].ToString()) + Convert.ToInt32(dr["PTTH_KT"].ToString()) +
                Convert.ToInt32(dr["PTTH_THUD"].ToString()) + Convert.ToInt32(dr["PTTH_TCNH"].ToString());
            int intKHAC_All = Convert.ToInt32(dr["KHAC_QTKD"].ToString()) + Convert.ToInt32(dr["KHAC_KT"].ToString()) +
                Convert.ToInt32(dr["KHAC_THUD"].ToString()) + Convert.ToInt32(dr["KHAC_TCNH"].ToString());
            string strHTML = "";
            strHTML += "\n <table width=\"100%\" align=\"center\" border=\"0\" >";
            strHTML += "\n     <tr>";
            strHTML += "\n          <td align=\"center\" ><span class=\"cssTitleReport2\">Báo cáo thông tin Ngành học trên Bằng cấp</span></td>";
            strHTML += "\n     </tr>";
            strHTML += "\n    <tr>";
            strHTML += "\n         <td align=\"center\" >";
            strHTML += "\n<table cellspacing=\"0\" cellpadding=\"0\" rules=\"all\" border=\"1\" style=\"width:778px;border-collapse:collapse;text-align:center;\"> ";
            strHTML += "\n    <tr class=\"cssGridHeader\"> ";
            strHTML += "\n        <td align=\"center\" style=\"width:50%;\" ><span class=\"cssTitleReport\">Ngành học \\ Bằng cấp</span></td> ";
            strHTML += "\n        <td align=\"center\" style=\"width:10%;\"><span class=\"cssTitleReport\">Đại học</span></td> ";
            strHTML += "\n        <td align=\"center\" style=\"width:10%;\"><span class=\"cssTitleReport\">Cao Đẳng</span></td> ";
            strHTML += "\n        <td align=\"center\" style=\"width:10%;\"><span class=\"cssTitleReport\">Trung cấp</span></td> ";
            strHTML += "\n        <td align=\"center\" style=\"width:10%;\"><span class=\"cssTitleReport\">PTTH</span></td> ";
            strHTML += "\n        <td align=\"center\" style=\"width:10%;\"><span class=\"cssTitleReport\">Khác</span></td> ";
            strHTML += "\n    </tr> ";
            strHTML += "\n    <tr class=\"cssGridCell\"> ";
            strHTML += "\n        <td align=\"left\" style=\"padding-left:10px;\"><span class=\"cssTitleReport\">Ngành Quản trị kinh doanh</span></td> ";
            strHTML += "\n        <td><span class=\"cssLabel\">" + dr["DH_QTKD"].ToString() + "</span></td> ";
            strHTML += "\n        <td><span class=\"cssLabel\">" + dr["CD_QTKD"].ToString() + "</span></td> ";
            strHTML += "\n        <td><span class=\"cssLabel\">" + dr["TC_QTKD"].ToString() + "</span></td> ";
            strHTML += "\n        <td><span class=\"cssLabel\">" + dr["PTTH_QTKD"].ToString() + "</span></td> ";
            strHTML += "\n        <td><span class=\"cssLabel\">" + dr["KHAC_QTKD"].ToString() + "</span></td> ";
            strHTML += "\n    </tr>	 ";
            strHTML += "\n    <tr class=\"cssGridAlterCell\"> ";
            strHTML += "\n        <td align=\"left\" style=\"padding-left:10px;\"><span class=\"cssTitleReport\">Ngành Kế toàn</span></td> ";
            strHTML += "\n        <td><span class=\"cssLabel\">" + dr["DH_KT"].ToString() + "</span></td> ";
            strHTML += "\n        <td><span class=\"cssLabel\">" + dr["CD_KT"].ToString() + "</span></td> ";
            strHTML += "\n        <td><span class=\"cssLabel\">" + dr["TC_KT"].ToString() + "</span></td> ";
            strHTML += "\n        <td><span class=\"cssLabel\">" + dr["PTTH_KT"].ToString() + "</span></td> ";
            strHTML += "\n        <td><span class=\"cssLabel\">" + dr["KHAC_KT"].ToString() + "</span></td> ";
            strHTML += "\n    </tr>	 ";
            strHTML += "\n    <tr class=\"cssGridCell\"> ";
            strHTML += "\n        <td align=\"left\" style=\"padding-left:10px;\"><span class=\"cssTitleReport\">Ngành Tin học ứng dụng</span></td> ";
            strHTML += "\n        <td><span class=\"cssLabel\">" + dr["DH_THUD"].ToString() + "</span></td> ";
            strHTML += "\n        <td><span class=\"cssLabel\">" + dr["CD_THUD"].ToString() + "</span></td> ";
            strHTML += "\n        <td><span class=\"cssLabel\">" + dr["TC_THUD"].ToString() + "</span></td> ";
            strHTML += "\n        <td><span class=\"cssLabel\">" + dr["PTTH_THUD"].ToString() + "</span></td> ";
            strHTML += "\n        <td><span class=\"cssLabel\">" + dr["KHAC_THUD"].ToString() + "</span></td> ";
            strHTML += "\n    </tr>		 ";
            strHTML += "\n    <tr class=\"cssGridAlterCell\"> ";
            strHTML += "\n        <td align=\"left\" style=\"padding-left:10px;\"><span class=\"cssTitleReport\">Ngành Tài chính ngân hàng</span></td> ";
            strHTML += "\n        <td><span class=\"cssLabel\">" + dr["DH_TCNH"].ToString() + "</span></td> ";
            strHTML += "\n        <td><span class=\"cssLabel\">" + dr["CD_TCNH"].ToString() + "</span></td> ";
            strHTML += "\n        <td><span class=\"cssLabel\">" + dr["TC_TCNH"].ToString() + "</span></td> ";
            strHTML += "\n        <td><span class=\"cssLabel\">" + dr["PTTH_TCNH"].ToString() + "</span></td> ";
            strHTML += "\n        <td><span class=\"cssLabel\">" + dr["KHAC_TCNH"].ToString() + "</span></td> ";
            strHTML += "\n    </tr>		 ";
            strHTML += "\n    <tr class=\"cssGridCell\"> ";
            strHTML += "\n        <td align=\"left\" style=\"padding-left:10px;\"><span class=\"cssTitleReport\">Tổng số Ngành học \\Bằng cấp</span></td> ";
            strHTML += "\n        <td><span class=\"cssLabel\">" + intDH_All.ToString() + "</span></td> ";
            strHTML += "\n        <td><span class=\"cssLabel\">" + intCD_All.ToString() + "</span></td> ";
            strHTML += "\n        <td><span class=\"cssLabel\">" + intTC_All.ToString() + "</span></td> ";
            strHTML += "\n        <td><span class=\"cssLabel\">" + intPTTH_All.ToString() + "</span></td> ";
            strHTML += "\n        <td><span class=\"cssLabel\">" + intKHAC_All.ToString() + "</span></td> ";
            strHTML += "\n    </tr>	 ";
            strHTML += "\n</table>	    ";
            strHTML += "\n   </td></tr>	 ";
            strHTML += "\n</table>	    ";
            return strHTML;
        }
        catch
        {
            return "";
        }
    }
    // Cái này load theo nhóm và tvts
    private string loadReport2A()
    {
        try
        {
            DateTime v_dat_nhap_tu_ngay, v_dat_nhap_den_ngay, v_dat_goi_tu_ngay, v_dat_goi_den_ngay;
            if (this.m_dat_nhap_tu_ngay.SelectedDate != Convert.ToDateTime("01/01/0001"))
                v_dat_nhap_tu_ngay = this.m_dat_nhap_tu_ngay.SelectedDate;
            else v_dat_nhap_tu_ngay = Convert.ToDateTime("01/01/1900");

            if (this.m_dat_nhap_den_ngay.SelectedDate != Convert.ToDateTime("01/01/0001"))
                v_dat_nhap_den_ngay = this.m_dat_nhap_den_ngay.SelectedDate;
            else v_dat_nhap_den_ngay = Convert.ToDateTime("01/01/1900");

            if (this.m_dat_goi_tu_ngay.SelectedDate != Convert.ToDateTime("01/01/0001"))
                v_dat_goi_tu_ngay = this.m_dat_goi_tu_ngay.SelectedDate;
            else v_dat_goi_tu_ngay = Convert.ToDateTime("01/01/1900");

            if (this.m_dat_goi_den_ngay.SelectedDate != Convert.ToDateTime("01/01/0001"))
                v_dat_goi_den_ngay = this.m_dat_goi_den_ngay.SelectedDate;
            else v_dat_goi_den_ngay = Convert.ToDateTime("01/01/1900");
            int v_i_id_nhom_tvts = Int32.Parse(m_cbo_nhom_tvts.SelectedValue);
            int v_i_id_tvts = Int32.Parse(m_cbo_tvts.SelectedValue);

            string strHTML = "<table width=\"100%\" align=\"center\" border=\"0\" >	";
            strHTML += "\n    <tr>";
            strHTML += "\n        <td align=\"center\" ><span class=\"cssTitleReport2\">Báo cáo tỷ lệ các Level</span></td>";
            strHTML += "\n    </tr>        ";
            strHTML += "\n    <tr>";
            strHTML += "\n        <td align=\"center\" >";
            strHTML += "\n            <table cellspacing=\"0\" cellpadding=\"0\" rules=\"all\" border=\"1\" style=\"width:850px;border-collapse:collapse;text-align:center;\">	                                    ";
            strHTML += "\n                <tr class=\"cssGridHeader\"> ";
            strHTML += "\n                    <td align=\"center\" style=\"width:10%;\" ><span class=\"cssTitleReport\">Nhóm</span></td>";
            strHTML += "\n                    <td align=\"center\" style=\"width:11%;\" ><span class=\"cssTitleReport\">TVTS</span></td>";
            strHTML += "\n                    <td align=\"center\" style=\"width:25%;\" ><span class=\"cssTitleReport\">Level (LX/LY)</span></td>";
            strHTML += "\n                    <td align=\"center\" style=\"width:7%;\"><span class=\"cssTitleReport\">L1</span></td>";
            strHTML += "\n                    <td align=\"center\" style=\"width:7%;\"><span class=\"cssTitleReport\">L2/L1</span></td>";
            strHTML += "\n                    <td align=\"center\" style=\"width:7%;\"><span class=\"cssTitleReport\">L3/L2</span></td>";
            strHTML += "\n                    <td align=\"center\" style=\"width:7%;\"><span class=\"cssTitleReport\">L4/L3</span></td>";
            strHTML += "\n                    <td align=\"center\" style=\"width:7%;\"><span class=\"cssTitleReport\">L5A/L4</span></td>";
            strHTML += "\n                    <td align=\"center\" style=\"width:7%;\"><span class=\"cssTitleReport\">L5B/L5A</span></td>";
            strHTML += "\n                    <td align=\"center\" style=\"width:7%;\"><span class=\"cssTitleReport\">L6/L5B</span></td>";
            strHTML += "\n                    <td align=\"center\" style=\"width:7%;\"><span class=\"cssTitleReport\">L7/L6</span></td>";
            strHTML += "\n                    <td align=\"center\" style=\"width:7%;\"><span class=\"cssTitleReport\">L8/L7</span></td>";
            strHTML += "\n                </tr>";
            // Hết phần header

            // Phần tính toán trong cho từng nhóm, từng tvts
            loadQuyenNhom_report2(ref strHTML, 4 
                                 , v_dat_nhap_tu_ngay, v_dat_nhap_den_ngay,v_dat_goi_tu_ngay
                                 , v_dat_goi_den_ngay
                                 , v_i_id_tvts, v_i_id_nhom_tvts);

            strHTML += "\n                </table>";
            strHTML += "\n        </td>";
            strHTML += "\n    </tr> ";
            strHTML += "\n</table>";
            return strHTML;
        }
        catch
        {
            return "";
        }
    }
    private string loadReport2A_All()
    {
        try
        {
            DateTime v_dat_nhap_tu_ngay, v_dat_nhap_den_ngay, v_dat_goi_tu_ngay, v_dat_goi_den_ngay;
            if (this.m_dat_nhap_tu_ngay.SelectedDate != Convert.ToDateTime("01/01/0001"))
                v_dat_nhap_tu_ngay = this.m_dat_nhap_tu_ngay.SelectedDate;
            else v_dat_nhap_tu_ngay = Convert.ToDateTime("01/01/1900");

            if (this.m_dat_nhap_den_ngay.SelectedDate != Convert.ToDateTime("01/01/0001"))
                v_dat_nhap_den_ngay = this.m_dat_nhap_den_ngay.SelectedDate;
            else v_dat_nhap_den_ngay = Convert.ToDateTime("01/01/1900");

            if (this.m_dat_goi_tu_ngay.SelectedDate != Convert.ToDateTime("01/01/0001"))
                v_dat_goi_tu_ngay = this.m_dat_goi_tu_ngay.SelectedDate;
            else v_dat_goi_tu_ngay = Convert.ToDateTime("01/01/1900");

            if (this.m_dat_goi_den_ngay.SelectedDate != Convert.ToDateTime("01/01/0001"))
                v_dat_goi_den_ngay = this.m_dat_goi_den_ngay.SelectedDate;
            else v_dat_goi_den_ngay = Convert.ToDateTime("01/01/1900");

            int v_i_id_tvts = Int32.Parse(m_cbo_tvts.SelectedValue);

            DataRow dr = objHocVien.loadReportTwoA(v_dat_nhap_tu_ngay
                                                  , v_dat_nhap_den_ngay
                                                  , v_dat_goi_tu_ngay
                                                  , v_dat_goi_den_ngay
                                                  , v_i_id_tvts);
            //DataRow dr = objHocVien.loadReport2();
            float intL21 = 0;
            int intL32 = 0;
            int intL43 = 0;
            int intL5A4 = 0;
            int intL5B5A = 0;
            int intL65B = 0;
            int intL76 = 0;
            int intL87 = 0;
            if (!dr["Level1"].ToString().Trim().Equals("0"))
            {
                intL21 = (Convert.ToInt32(dr["Level2"]) * 100) / Convert.ToInt32(dr["Level1"]);
            }
            if (!dr["Level2"].ToString().Trim().Equals("0"))
            {
                intL32 = (Convert.ToInt32(dr["Level3"]) * 100) / Convert.ToInt32(dr["Level2"]);
            }
            if (!dr["Level3"].ToString().Trim().Equals("0"))
            {
                intL43 = (Convert.ToInt32(dr["Level4"]) * 100) / Convert.ToInt32(dr["Level3"]);
            }
            if (!dr["Level4"].ToString().Trim().Equals("0"))
            {
                intL5A4 = (Convert.ToInt32(dr["Level5A"]) * 100) / Convert.ToInt32(dr["Level4"]);
            }
            if (!dr["Level5A"].ToString().Trim().Equals("0"))
            {
                intL5B5A = (Convert.ToInt32(dr["Level5B"]) * 100) / Convert.ToInt32(dr["Level5A"]);
            }
            if (!dr["Level5B"].ToString().Trim().Equals("0"))
            {
                intL65B = (Convert.ToInt32(dr["Level6"]) * 100) / Convert.ToInt32(dr["Level5B"]);
            }
            if (!dr["Level6"].ToString().Trim().Equals("0"))
            {
                intL76 = (Convert.ToInt32(dr["Level7"]) * 100) / Convert.ToInt32(dr["Level6"]);
            }
            if (!dr["Level7"].ToString().Trim().Equals("0"))
            {
                intL87 = (Convert.ToInt32(dr["Level8"]) * 100) / Convert.ToInt32(dr["Level7"]);
            }
            string strHTML = "<table width=\"100%\" align=\"center\" border=\"0\" >	";
            strHTML += "\n    <tr>";
            strHTML += "\n        <td align=\"center\" ><span class=\"cssTitleReport2\">Báo cáo tỷ lệ các Level</span></td>";
            strHTML += "\n    </tr>        ";
            strHTML += "\n    <tr>";
            strHTML += "\n        <td align=\"center\" >";
            strHTML += "\n            <table cellspacing=\"0\" cellpadding=\"0\" rules=\"all\" border=\"1\" style=\"width:778px;border-collapse:collapse;text-align:center;\">	                                    ";
            strHTML += "\n                <tr class=\"cssGridHeader\"> ";
            strHTML += "\n                    <td align=\"center\" style=\"width:28%;\" ><span class=\"cssTitleReport\">Level (LX/LY)</span></td>";
            strHTML += "\n                    <td align=\"center\" style=\"width:8%;\"><span class=\"cssTitleReport\">L1</span></td>";
            strHTML += "\n                    <td align=\"center\" style=\"width:8%;\"><span class=\"cssTitleReport\">L2/L1</span></td>";
            strHTML += "\n                    <td align=\"center\" style=\"width:8%;\"><span class=\"cssTitleReport\">L3/L2</span></td>";
            strHTML += "\n                    <td align=\"center\" style=\"width:8%;\"><span class=\"cssTitleReport\">L4/L3</span></td>";
            strHTML += "\n                    <td align=\"center\" style=\"width:8%;\"><span class=\"cssTitleReport\">L5A/L4</span></td>";
            strHTML += "\n                    <td align=\"center\" style=\"width:8%;\"><span class=\"cssTitleReport\">L5B/L5A</span></td>";
            strHTML += "\n                    <td align=\"center\" style=\"width:8%;\"><span class=\"cssTitleReport\">L6/L5B</span></td>";
            strHTML += "\n                    <td align=\"center\" style=\"width:8%;\"><span class=\"cssTitleReport\">L7/L6</span></td>";
            strHTML += "\n                    <td align=\"center\" style=\"width:8%;\"><span class=\"cssTitleReport\">L8/L7</span></td>";
            strHTML += "\n                </tr>";
            strHTML += "\n                    <tr class=\"cssGridCell\">";
            strHTML += "\n                        <td align=\"left\" style=\"padding-left:10px;\"><span class=\"cssTitleReport\">LX/LY (%)</span></td>";
            strHTML += "\n                        <td align=\"center\" ><span class=\"cssLabel\">100%</span></td>";
            strHTML += "\n                        <td align=\"center\" ><span class=\"cssLabel\">" + intL21.ToString() + "%</span></td>";
            strHTML += "\n                        <td align=\"center\" ><span class=\"cssLabel\">" + intL32.ToString() + "%</span></td>";
            strHTML += "\n                        <td align=\"center\" ><span class=\"cssLabel\">" + intL43.ToString() + "%</span></td>";
            strHTML += "\n                        <td align=\"center\" ><span class=\"cssLabel\">" + intL5A4.ToString() + "%</span></td>";
            strHTML += "\n                        <td align=\"center\" ><span class=\"cssLabel\">" + intL5B5A.ToString() + "%</span></td>";
            strHTML += "\n                        <td align=\"center\" ><span class=\"cssLabel\">" + intL65B.ToString() + "%</span></td>";
            strHTML += "\n                        <td align=\"center\" ><span class=\"cssLabel\">" + intL76.ToString() + "%</span></td>";
            strHTML += "\n                        <td align=\"center\" ><span class=\"cssLabel\">" + intL87.ToString() + "%</span></td>";
            strHTML += "\n                    </tr>";
            strHTML += "\n                    <tr class=\"cssGridAlterCell\">";
            strHTML += "\n                        <td align=\"left\" style=\"padding-left:10px;\"><span class=\"cssTitleReport\">Số lượng LX (Học sinh)</span></td>";
            strHTML += "\n                        <td align=\"center\" ><span class=\"cssLabel\">" + dr["Level1"].ToString() + "</span></td>";
            strHTML += "\n                        <td align=\"center\" ><span class=\"cssLabel\">" + dr["Level2"].ToString() + "</span></td>";
            strHTML += "\n                        <td align=\"center\" ><span class=\"cssLabel\">" + dr["Level3"].ToString() + "</span></td>";
            strHTML += "\n                        <td align=\"center\" ><span class=\"cssLabel\">" + dr["Level4"].ToString() + "</span></td>";
            strHTML += "\n                        <td align=\"center\" ><span class=\"cssLabel\">" + dr["Level5a"].ToString() + "</span></td>";
            strHTML += "\n                        <td align=\"center\" ><span class=\"cssLabel\">" + dr["Level5b"].ToString() + "</span></td>";
            strHTML += "\n                        <td align=\"center\" ><span class=\"cssLabel\">" + dr["Level6"].ToString() + "</span></td>";
            strHTML += "\n                        <td align=\"center\" ><span class=\"cssLabel\">" + dr["Level7"].ToString() + "</span></td>";
            strHTML += "\n                        <td align=\"center\" ><span class=\"cssLabel\">" + dr["Level8"].ToString() + "</span></td>";
            strHTML += "\n                    </tr>";
            strHTML += "\n                </table>";
            strHTML += "\n        </td>";
            strHTML += "\n    </tr> ";
            strHTML += "\n</table>";
            return strHTML;
        }
        catch
        {
            return "";
        }
    }
    private string loadReport2A_callBack(int ip_i_id_tvts
                                    , DateTime ip_dat_nhap_tu_ngay
                                    , DateTime ip_dat_nhap_den_ngay
                                    , DateTime ip_dat_goi_tu_ngay
                                    , DateTime ip_dat_goi_den_ngay)
    {
        try
        {
            DataRow dr = objHocVien.loadReportTwoA(ip_dat_nhap_tu_ngay
                                                  , ip_dat_nhap_den_ngay
                                                  , ip_dat_goi_tu_ngay
                                                  , ip_dat_goi_den_ngay
                                                  , ip_i_id_tvts);
            //DataRow dr = objHocVien.loadReport2();
            float intL21 = 0;
            int intL32 = 0;
            int intL43 = 0;
            int intL5A4 = 0;
            int intL5B5A = 0;
            int intL65B = 0;
            int intL76 = 0;
            int intL87 = 0;
            if (!dr["Level1"].ToString().Trim().Equals("0"))
            {
                intL21 = (Convert.ToInt32(dr["Level2"]) * 100) / Convert.ToInt32(dr["Level1"]);
            }
            if (!dr["Level2"].ToString().Trim().Equals("0"))
            {
                intL32 = (Convert.ToInt32(dr["Level3"]) * 100) / Convert.ToInt32(dr["Level2"]);
            }
            if (!dr["Level3"].ToString().Trim().Equals("0"))
            {
                intL43 = (Convert.ToInt32(dr["Level4"]) * 100) / Convert.ToInt32(dr["Level3"]);
            }
            if (!dr["Level4"].ToString().Trim().Equals("0"))
            {
                intL5A4 = (Convert.ToInt32(dr["Level5A"]) * 100) / Convert.ToInt32(dr["Level4"]);
            }
            if (!dr["Level5A"].ToString().Trim().Equals("0"))
            {
                intL5B5A = (Convert.ToInt32(dr["Level5B"]) * 100) / Convert.ToInt32(dr["Level5A"]);
            }
            if (!dr["Level5B"].ToString().Trim().Equals("0"))
            {
                intL65B = (Convert.ToInt32(dr["Level6"]) * 100) / Convert.ToInt32(dr["Level5B"]);
            }
            if (!dr["Level6"].ToString().Trim().Equals("0"))
            {
                intL76 = (Convert.ToInt32(dr["Level7"]) * 100) / Convert.ToInt32(dr["Level6"]);
            }
            if (!dr["Level7"].ToString().Trim().Equals("0"))
            {
                intL87 = (Convert.ToInt32(dr["Level8"]) * 100) / Convert.ToInt32(dr["Level7"]);
            }
            string strHTML = "<table width=\"100%\" align=\"center\" border=\"0\" >	";
            strHTML += "\n    <tr>";
            strHTML += "\n        <td align=\"center\" ><span class=\"cssTitleReport2\">Báo cáo tỷ lệ các Level</span></td>";
            strHTML += "\n    </tr>        ";
            strHTML += "\n    <tr>";
            strHTML += "\n        <td align=\"center\" >";
            strHTML += "\n            <table cellspacing=\"0\" cellpadding=\"0\" rules=\"all\" border=\"1\" style=\"width:778px;border-collapse:collapse;text-align:center;\">	                                    ";
            strHTML += "\n                <tr class=\"cssGridHeader\"> ";
            strHTML += "\n                    <td align=\"center\" style=\"width:28%;\" ><span class=\"cssTitleReport\">Level (LX/LY)</span></td>";
            strHTML += "\n                    <td align=\"center\" style=\"width:8%;\"><span class=\"cssTitleReport\">L1</span></td>";
            strHTML += "\n                    <td align=\"center\" style=\"width:8%;\"><span class=\"cssTitleReport\">L2/L1</span></td>";
            strHTML += "\n                    <td align=\"center\" style=\"width:8%;\"><span class=\"cssTitleReport\">L3/L2</span></td>";
            strHTML += "\n                    <td align=\"center\" style=\"width:8%;\"><span class=\"cssTitleReport\">L4/L3</span></td>";
            strHTML += "\n                    <td align=\"center\" style=\"width:8%;\"><span class=\"cssTitleReport\">L5A/L4</span></td>";
            strHTML += "\n                    <td align=\"center\" style=\"width:8%;\"><span class=\"cssTitleReport\">L5B/L5A</span></td>";
            strHTML += "\n                    <td align=\"center\" style=\"width:8%;\"><span class=\"cssTitleReport\">L6/L5B</span></td>";
            strHTML += "\n                    <td align=\"center\" style=\"width:8%;\"><span class=\"cssTitleReport\">L7/L6</span></td>";
            strHTML += "\n                    <td align=\"center\" style=\"width:8%;\"><span class=\"cssTitleReport\">L8/L7</span></td>";
            strHTML += "\n                </tr>";
            strHTML += "\n                    <tr class=\"cssGridCell\">";
            strHTML += "\n                        <td align=\"left\" style=\"padding-left:10px;\"><span class=\"cssTitleReport\">LX/LY (%)</span></td>";
            strHTML += "\n                        <td align=\"center\" ><span class=\"cssLabel\">100%</span></td>";
            strHTML += "\n                        <td align=\"center\" ><span class=\"cssLabel\">" + intL21.ToString() + "%</span></td>";
            strHTML += "\n                        <td align=\"center\" ><span class=\"cssLabel\">" + intL32.ToString() + "%</span></td>";
            strHTML += "\n                        <td align=\"center\" ><span class=\"cssLabel\">" + intL43.ToString() + "%</span></td>";
            strHTML += "\n                        <td align=\"center\" ><span class=\"cssLabel\">" + intL5A4.ToString() + "%</span></td>";
            strHTML += "\n                        <td align=\"center\" ><span class=\"cssLabel\">" + intL5B5A.ToString() + "%</span></td>";
            strHTML += "\n                        <td align=\"center\" ><span class=\"cssLabel\">" + intL65B.ToString() + "%</span></td>";
            strHTML += "\n                        <td align=\"center\" ><span class=\"cssLabel\">" + intL76.ToString() + "%</span></td>";
            strHTML += "\n                        <td align=\"center\" ><span class=\"cssLabel\">" + intL87.ToString() + "%</span></td>";
            strHTML += "\n                    </tr>";
            strHTML += "\n                    <tr class=\"cssGridAlterCell\">";
            strHTML += "\n                        <td align=\"left\" style=\"padding-left:10px;\"><span class=\"cssTitleReport\">Số lượng LX (Học sinh)</span></td>";
            strHTML += "\n                        <td align=\"center\" ><span class=\"cssLabel\">" + dr["Level1"].ToString() + "</span></td>";
            strHTML += "\n                        <td align=\"center\" ><span class=\"cssLabel\">" + dr["Level2"].ToString() + "</span></td>";
            strHTML += "\n                        <td align=\"center\" ><span class=\"cssLabel\">" + dr["Level3"].ToString() + "</span></td>";
            strHTML += "\n                        <td align=\"center\" ><span class=\"cssLabel\">" + dr["Level4"].ToString() + "</span></td>";
            strHTML += "\n                        <td align=\"center\" ><span class=\"cssLabel\">" + dr["Level5a"].ToString() + "</span></td>";
            strHTML += "\n                        <td align=\"center\" ><span class=\"cssLabel\">" + dr["Level5b"].ToString() + "</span></td>";
            strHTML += "\n                        <td align=\"center\" ><span class=\"cssLabel\">" + dr["Level6"].ToString() + "</span></td>";
            strHTML += "\n                        <td align=\"center\" ><span class=\"cssLabel\">" + dr["Level7"].ToString() + "</span></td>";
            strHTML += "\n                        <td align=\"center\" ><span class=\"cssLabel\">" + dr["Level8"].ToString() + "</span></td>";
            strHTML += "\n                    </tr>";
            strHTML += "\n                </table>";
            strHTML += "\n        </td>";
            strHTML += "\n    </tr> ";
            strHTML += "\n</table>";
            return strHTML;
        }
        catch
        {
            return "";
        }
    }
    private string loadReport1()
    {
        try
        {
            DataRow dr = objHocVien.loadReport1();			
			int intDH_All = Convert.ToInt32(dr["DH_QTKD"].ToString()) + Convert.ToInt32(dr["DH_KT"].ToString()) +
                Convert.ToInt32(dr["DH_THUD"].ToString()) + Convert.ToInt32(dr["DH_TCNH"].ToString());
            int intCD_All = Convert.ToInt32(dr["CD_QTKD"].ToString()) + Convert.ToInt32(dr["CD_KT"].ToString()) +
                Convert.ToInt32(dr["CD_THUD"].ToString()) + Convert.ToInt32(dr["CD_TCNH"].ToString());
            int intTC_All = Convert.ToInt32(dr["TC_QTKD"].ToString()) + Convert.ToInt32(dr["TC_KT"].ToString()) +
                Convert.ToInt32(dr["TC_THUD"].ToString()) + Convert.ToInt32(dr["TC_TCNH"].ToString());
            int intPTTH_All = Convert.ToInt32(dr["PTTH_QTKD"].ToString()) + Convert.ToInt32(dr["PTTH_KT"].ToString()) +
                Convert.ToInt32(dr["PTTH_THUD"].ToString()) + Convert.ToInt32(dr["PTTH_TCNH"].ToString());
            int intKHAC_All = Convert.ToInt32(dr["KHAC_QTKD"].ToString()) + Convert.ToInt32(dr["KHAC_KT"].ToString()) +
                Convert.ToInt32(dr["KHAC_THUD"].ToString()) + Convert.ToInt32(dr["KHAC_TCNH"].ToString());
            string strHTML = "<html xmlns:o=\"urn:schemas-microsoft-com:office:office\" "; 
            strHTML += "\n xmlns:x=\"urn:schemas-microsoft-com:office:excel\" ";
            strHTML += "\n xmlns=\"http://www.w3.org/TR/REC-html40\"> ";
            strHTML += "\n <head> ";
            strHTML += "\n <meta http-equiv=Content-Type content=\"text/html; charset=UTF-8\"> ";
            strHTML += "\n <meta name=ProgId content=Excel.Sheet> ";
            strHTML += "\n <meta name=Generator content=\"Microsoft Excel 11\"> ";
            strHTML += "\n <link rel=File-List ";
            strHTML += "\n href=\"New%20Microsoft%20Excel%20Worksheet_files/filelist.xml\"> ";
            strHTML += "\n <link rel=Edit-Time-Data ";
            strHTML += "\n href=\"New%20Microsoft%20Excel%20Worksheet_files/editdata.mso\"> ";
            strHTML += "\n <link rel=OLE-Object-Data ";
            strHTML += "\n href=\"New%20Microsoft%20Excel%20Worksheet_files/oledata.mso\"> ";
            strHTML += "\n <!--[if gte mso 9]><xml> ";
            strHTML += "\n  <o:DocumentProperties> ";
            strHTML += "\n   <o:LastAuthor>User</o:LastAuthor> ";
            strHTML += "\n   <o:Created>1996-10-14T23:33:28Z</o:Created> ";
            strHTML += "\n   <o:LastSaved>2009-06-04T09:49:20Z</o:LastSaved> ";
            strHTML += "\n   <o:Version>11.5606</o:Version> ";
            strHTML += "\n </o:DocumentProperties> ";
            strHTML += "\n </xml><![endif]--> ";
            strHTML += "\n <style> ";
            strHTML += "\n <!--table ";
            strHTML += "\n      {mso-displayed-decimal-separator:\"\\.\"; ";
            strHTML += "\n      mso-displayed-thousand-separator:\"\\,\";} ";
            strHTML += "\n @page ";
            strHTML += "\n      {margin:1.0in .75in 1.0in .75in; ";
            strHTML += "\n      mso-header-margin:.5in; ";
            strHTML += "\n 	mso-footer-margin:.5in;} ";
            strHTML += "\n tr ";
            strHTML += "\n 	{mso-height-source:auto;} ";
            strHTML += "\n col ";
            strHTML += "\n 	{mso-width-source:auto;} ";
            strHTML += "\n br ";
            strHTML += "\n 	{mso-data-placement:same-cell;} ";
            strHTML += "\n .style0 ";
            strHTML += "\n 	{mso-number-format:General; ";
            strHTML += "\n 	text-align:general; ";
            strHTML += "\n 	vertical-align:bottom; ";
            strHTML += "\n 	white-space:nowrap; ";
            strHTML += "\n 	mso-rotate:0; ";
            strHTML += "\n 	mso-background-source:auto; ";
            strHTML += "\n 	mso-pattern:auto; ";
            strHTML += "\n 	color:windowtext; ";
            strHTML += "\n 	font-size:10.0pt; ";
            strHTML += "\n 	font-weight:400; ";
            strHTML += "\n 	font-style:normal; ";
            strHTML += "\n 	text-decoration:none; ";
            strHTML += "\n 	font-family:Arial; ";
            strHTML += "\n 	mso-generic-font-family:auto; ";
            strHTML += "\n 	mso-font-charset:0; ";
            strHTML += "\n 	border:none; ";
            strHTML += "\n 	mso-protection:locked visible; ";
            strHTML += "\n 	mso-style-name:Normal; ";
            strHTML += "\n 	mso-style-id:0;} ";
            strHTML += "\n td ";
            strHTML += "\n 	{mso-style-parent:style0; ";
            strHTML += "\n 	padding-top:1px; ";
            strHTML += "\n 	padding-right:1px; ";
            strHTML += "\n 	padding-left:1px; ";
            strHTML += "\n 	mso-ignore:padding; ";
            strHTML += "\n 	color:windowtext; ";
            strHTML += "\n 	font-size:10.0pt; ";
            strHTML += "\n 	font-weight:400; ";
            strHTML += "\n 	font-style:normal; ";
            strHTML += "\n 	text-decoration:none; ";
            strHTML += "\n 	font-family:Arial; ";
            strHTML += "\n 	mso-generic-font-family:auto; ";
            strHTML += "\n 	mso-font-charset:0; ";
            strHTML += "\n 	mso-number-format:General; ";
            strHTML += "\n 	text-align:general; ";
            strHTML += "\n 	vertical-align:bottom; ";
            strHTML += "\n 	border:none; ";
            strHTML += "\n 	mso-background-source:auto; ";
            strHTML += "\n 	mso-pattern:auto; ";
            strHTML += "\n 	mso-protection:locked visible; ";
            strHTML += "\n 	white-space:nowrap; ";
            strHTML += "\n 	mso-rotate:0;} ";
            strHTML += "\n .xl23 ";
            strHTML += "\n 	{mso-style-parent:style0; ";
            strHTML += "\n 		font-weight:1600; ";
            strHTML += "\n 		font-family:Arial, sans-serif; ";
            strHTML += "\n 		mso-font-charset:0; ";
            strHTML += "\n 		mso-pattern:auto none;} ";
            strHTML += "\n 	text-align:center;} ";
            strHTML += "\n .xl24 ";
            strHTML += "\n 	{mso-style-parent:style0; ";
            strHTML += "\n 	    color: white; ";
            strHTML += "\n 		font-weight:1000; ";
            strHTML += "\n 		font-family:Arial, sans-serif; ";
            strHTML += "\n 		mso-font-charset:0; ";
            strHTML += "\n 		text-align:center; ";
            strHTML += "\n 		background:Black; ";
            strHTML += "\n 		mso-pattern:auto none;} ";
            strHTML += "\n 	text-align:center;} ";
            strHTML += "\n 	.xl25 ";
            strHTML += "\n 	{	font-family:Arial, sans-serif; ";
            strHTML += "\n 		mso-font-charset:0; ";
            strHTML += "\n 		text-align:center; ";
            strHTML += "\n 		mso-pattern:auto none;} ";
            strHTML += "\n 	.xl26 ";
            strHTML += "\n 		{mso-style-parent:style0; ";
            strHTML += "\n 		mso-pattern:auto none;} ";
            strHTML += "\n --> ";
            strHTML += "\n </style> ";
            strHTML += "\n <!--[if gte mso 9]><xml> ";
            strHTML += "\n  <x:ExcelWorkbook> ";
            strHTML += "\n   <x:ExcelWorksheets> ";
            strHTML += "\n    <x:ExcelWorksheet> ";
            strHTML += "\n     <x:Name>Sheet1</x:Name> ";
            strHTML += "\n     <x:WorksheetOptions> ";
            strHTML += "\n      <x:Selected/> ";
            strHTML += "\n      <x:Panes> ";
            strHTML += "\n       <x:Pane> ";
            strHTML += "\n        <x:Number>3</x:Number> ";
            strHTML += "\n        <x:ActiveRow>2</x:ActiveRow> ";
            strHTML += "\n        <x:ActiveCol>3</x:ActiveCol> ";
            strHTML += "\n       </x:Pane> ";
            strHTML += "\n      </x:Panes> ";
            strHTML += "\n      <x:ProtectContents>False</x:ProtectContents> ";
            strHTML += "\n      <x:ProtectObjects>False</x:ProtectObjects> ";
            strHTML += "\n      <x:ProtectScenarios>False</x:ProtectScenarios> ";
            strHTML += "\n     </x:WorksheetOptions> ";
            strHTML += "\n    </x:ExcelWorksheet> ";
            strHTML += "\n    <x:ExcelWorksheet> ";
            strHTML += "\n     <x:Name>Sheet2</x:Name> ";
            strHTML += "\n     <x:WorksheetOptions> ";
            strHTML += "\n      <x:ProtectContents>False</x:ProtectContents> ";
            strHTML += "\n      <x:ProtectObjects>False</x:ProtectObjects> ";
            strHTML += "\n      <x:ProtectScenarios>False</x:ProtectScenarios> ";
            strHTML += "\n     </x:WorksheetOptions> ";
            strHTML += "\n    </x:ExcelWorksheet> ";
            strHTML += "\n    <x:ExcelWorksheet> ";
            strHTML += "\n     <x:Name>Sheet3</x:Name> ";
            strHTML += "\n     <x:WorksheetOptions> ";
            strHTML += "\n      <x:ProtectContents>False</x:ProtectContents> ";
            strHTML += "\n      <x:ProtectObjects>False</x:ProtectObjects> ";
            strHTML += "\n      <x:ProtectScenarios>False</x:ProtectScenarios> ";
            strHTML += "\n     </x:WorksheetOptions> ";
            strHTML += "\n    </x:ExcelWorksheet> ";
            strHTML += "\n   </x:ExcelWorksheets> ";
            strHTML += "\n   <x:WindowHeight>9300</x:WindowHeight> ";
            strHTML += "\n   <x:WindowWidth>15135</x:WindowWidth> ";
            strHTML += "\n   <x:WindowTopX>120</x:WindowTopX> ";
            strHTML += "\n   <x:WindowTopY>120</x:WindowTopY> ";
            strHTML += "\n   <x:AcceptLabelsInFormulas/> ";
            strHTML += "\n   <x:ProtectStructure>False</x:ProtectStructure> ";
            strHTML += "\n   <x:ProtectWindows>False</x:ProtectWindows> ";
            strHTML += "\n  </x:ExcelWorkbook> ";
            strHTML += "\n </xml><![endif]--> ";
            strHTML += "\n </head> ";

            strHTML += "\n <body link=blue vlink=purple> ";
            strHTML += "\n <table x:str border=0 cellpadding=0 cellspacing=0 width=640 style='border-collapse: ";
            strHTML += "\n  collapse;table-layout:fixed;width:100%'> ";
            strHTML += "\n  <col span=6 style='width:100%'>";
		    strHTML += "\n     <tr>";
            strHTML += "\n          <td class=xl23 colspan=6><span class=\"cssTitleReport2\">Báo cáo thông tin Ngành học trên Bằng cấp</span></td>";
		    strHTML += "\n     </tr>";
            strHTML += "\n    <tr class=\"cssGridHeader\"> ";
            strHTML += "\n        <td class=xl24 style=\"width:50%;\" ><span class=\"cssTitleReport\">Ngành học \\ Bằng cấp</span></td> ";
            strHTML += "\n        <td class=xl24 style=\"width:10%;\"><span class=\"cssTitleReport\">Đại học</span></td> ";
            strHTML += "\n        <td class=xl24 style=\"width:10%;\"><span class=\"cssTitleReport\">Cao Đẳng</span></td> ";
            strHTML += "\n        <td class=xl24 style=\"width:10%;\"><span class=\"cssTitleReport\">Trung cấp</span></td> ";
            strHTML += "\n        <td class=xl24 style=\"width:10%;\"><span class=\"cssTitleReport\">PTTH</span></td> ";
            strHTML += "\n        <td class=xl24 style=\"width:10%;\"><span class=\"cssTitleReport\">Khác</span></td> ";
            strHTML += "\n    </tr> ";
            strHTML += "\n    <tr class=\"cssGridCell\"> ";
            strHTML += "\n        <td align=\"left\" style=\"padding-left:10px;\"><span class=\"cssTitleReport\">Ngành Quản trị kinh doanh</span></td> ";
            strHTML += "\n        <td><span class=\"cssLabel\">" + dr["DH_QTKD"].ToString() + "</span></td> ";
            strHTML += "\n        <td><span class=\"cssLabel\">" + dr["CD_QTKD"].ToString() + "</span></td> ";
            strHTML += "\n        <td><span class=\"cssLabel\">" + dr["TC_QTKD"].ToString() + "</span></td> ";
            strHTML += "\n        <td><span class=\"cssLabel\">" + dr["PTTH_QTKD"].ToString() + "</span></td> ";
            strHTML += "\n        <td><span class=\"cssLabel\">" + dr["KHAC_QTKD"].ToString() + "</span></td> ";
            strHTML += "\n    </tr>	 ";
            strHTML += "\n    <tr class=\"cssGridAlterCell\"> ";
            strHTML += "\n        <td align=\"left\" style=\"padding-left:10px;\"><span class=\"cssTitleReport\">Ngành Kế toàn</span></td> ";
            strHTML += "\n        <td><span class=\"cssLabel\">" + dr["DH_KT"].ToString() + "</span></td> ";
            strHTML += "\n        <td><span class=\"cssLabel\">" + dr["CD_KT"].ToString() + "</span></td> ";
            strHTML += "\n        <td><span class=\"cssLabel\">" + dr["TC_KT"].ToString() + "</span></td> ";
            strHTML += "\n        <td><span class=\"cssLabel\">" + dr["PTTH_KT"].ToString() + "</span></td> ";
            strHTML += "\n        <td><span class=\"cssLabel\">" + dr["KHAC_KT"].ToString() + "</span></td> ";
            strHTML += "\n    </tr>	 ";
            strHTML += "\n    <tr class=\"cssGridCell\"> ";
            strHTML += "\n        <td align=\"left\" style=\"padding-left:10px;\"><span class=\"cssTitleReport\">Ngành Tin học ứng dụng</span></td> ";
            strHTML += "\n        <td><span class=\"cssLabel\">" + dr["DH_THUD"].ToString() + "</span></td> ";
            strHTML += "\n        <td><span class=\"cssLabel\">" + dr["CD_THUD"].ToString() + "</span></td> ";
            strHTML += "\n        <td><span class=\"cssLabel\">" + dr["TC_THUD"].ToString() + "</span></td> ";
            strHTML += "\n        <td><span class=\"cssLabel\">" + dr["PTTH_THUD"].ToString() + "</span></td> ";
            strHTML += "\n        <td><span class=\"cssLabel\">" + dr["KHAC_THUD"].ToString() + "</span></td> ";
            strHTML += "\n    </tr>		 ";
            strHTML += "\n    <tr class=\"cssGridAlterCell\"> ";
            strHTML += "\n        <td align=\"left\" style=\"padding-left:10px;\"><span class=\"cssTitleReport\">Ngành Tài chính ngân hàng</span></td> ";
            strHTML += "\n        <td><span class=\"cssLabel\">" + dr["DH_TCNH"].ToString() + "</span></td> ";
            strHTML += "\n        <td><span class=\"cssLabel\">" + dr["CD_TCNH"].ToString() + "</span></td> ";
            strHTML += "\n        <td><span class=\"cssLabel\">" + dr["TC_TCNH"].ToString() + "</span></td> ";
            strHTML += "\n        <td><span class=\"cssLabel\">" + dr["PTTH_TCNH"].ToString() + "</span></td> ";
            strHTML += "\n        <td><span class=\"cssLabel\">" + dr["KHAC_TCNH"].ToString() + "</span></td> ";
            strHTML += "\n    </tr>		 ";
            strHTML += "\n    <tr class=\"cssGridCell\"> ";
            strHTML += "\n        <td align=\"left\" style=\"padding-left:10px;\"><span class=\"cssTitleReport\">Tổng số Ngành học \\Bằng cấp</span></td> ";
            strHTML += "\n        <td><span class=\"cssLabel\">" + intDH_All.ToString() + "</span></td> ";
            strHTML += "\n        <td><span class=\"cssLabel\">" + intCD_All.ToString() + "</span></td> ";
            strHTML += "\n        <td><span class=\"cssLabel\">" + intTC_All.ToString() + "</span></td> ";
            strHTML += "\n        <td><span class=\"cssLabel\">" + intPTTH_All.ToString() + "</span></td> ";
            strHTML += "\n        <td><span class=\"cssLabel\">" + intKHAC_All.ToString() + "</span></td> ";
            strHTML += "\n    </tr>	 ";
            strHTML += "\n </table> ";
            strHTML += "\n </body> ";
            strHTML += "\n </html> ";
  
            return strHTML;
        }
        catch
        {
            return "";
        }
    }

    private string loadReport2()
    {
        try
        {
            DataRow dr = objHocVien.loadReport2();
            float intL21 = 0;
            int intL32 = 0;
            int intL43 = 0;
            int intL5A4 = 0;
            int intL5B5A = 0;
            int intL65B = 0;
            int intL76 = 0;
            int intL87 = 0;
            if (!dr["Level1"].ToString().Trim().Equals("0"))
            {
                intL21 = (Convert.ToInt32(dr["Level2"]) * 100) / Convert.ToInt32(dr["Level1"]);
            }
            if (!dr["Level2"].ToString().Trim().Equals("0"))
            {
                intL32 = (Convert.ToInt32(dr["Level3"]) * 100) / Convert.ToInt32(dr["Level2"]);
            }
            if (!dr["Level3"].ToString().Trim().Equals("0"))
            {
                intL43 = (Convert.ToInt32(dr["Level4"]) * 100) / Convert.ToInt32(dr["Level3"]);
            }
            if (!dr["Level4"].ToString().Trim().Equals("0"))
            {
                intL5A4 = (Convert.ToInt32(dr["Level5A"]) * 100) / Convert.ToInt32(dr["Level4"]);
            }
            if (!dr["Level5A"].ToString().Trim().Equals("0"))
            {
                intL5B5A = (Convert.ToInt32(dr["Level5B"]) * 100) / Convert.ToInt32(dr["Level5A"]);
            }
            if (!dr["Level5B"].ToString().Trim().Equals("0"))
            {
                intL65B = (Convert.ToInt32(dr["Level6"]) * 100) / Convert.ToInt32(dr["Level5B"]);
            }
            if (!dr["Level6"].ToString().Trim().Equals("0"))
            {
                intL76 = (Convert.ToInt32(dr["Level7"]) * 100) / Convert.ToInt32(dr["Level6"]);
            }
            if (!dr["Level7"].ToString().Trim().Equals("0"))
            {
                intL87 = (Convert.ToInt32(dr["Level8"]) * 100) / Convert.ToInt32(dr["Level7"]);
            }
            string strHTML = "<html xmlns:o=\"urn:schemas-microsoft-com:office:office\" ";
            strHTML += "\n xmlns:x=\"urn:schemas-microsoft-com:office:excel\" ";
            strHTML += "\n xmlns=\"http://www.w3.org/TR/REC-html40\"> ";
            strHTML += "\n <head> ";
            strHTML += "\n <meta http-equiv=Content-Type content=\"text/html; charset=UTF-8\"> ";
            strHTML += "\n <meta name=ProgId content=Excel.Sheet> ";
            strHTML += "\n <meta name=Generator content=\"Microsoft Excel 11\"> ";
            strHTML += "\n <link rel=File-List ";
            strHTML += "\n href=\"New%20Microsoft%20Excel%20Worksheet_files/filelist.xml\"> ";
            strHTML += "\n <link rel=Edit-Time-Data ";
            strHTML += "\n href=\"New%20Microsoft%20Excel%20Worksheet_files/editdata.mso\"> ";
            strHTML += "\n <link rel=OLE-Object-Data ";
            strHTML += "\n href=\"New%20Microsoft%20Excel%20Worksheet_files/oledata.mso\"> ";
            strHTML += "\n <!--[if gte mso 9]><xml> ";
            strHTML += "\n  <o:DocumentProperties> ";
            strHTML += "\n   <o:LastAuthor>User</o:LastAuthor> ";
            strHTML += "\n   <o:Created>1996-10-14T23:33:28Z</o:Created> ";
            strHTML += "\n   <o:LastSaved>2009-06-04T09:49:20Z</o:LastSaved> ";
            strHTML += "\n   <o:Version>11.5606</o:Version> ";
            strHTML += "\n </o:DocumentProperties> ";
            strHTML += "\n </xml><![endif]--> ";
            strHTML += "\n <style> ";
            strHTML += "\n <!--table ";
            strHTML += "\n      {mso-displayed-decimal-separator:\"\\.\"; ";
            strHTML += "\n      mso-displayed-thousand-separator:\"\\,\";} ";
            strHTML += "\n @page ";
            strHTML += "\n      {margin:1.0in .75in 1.0in .75in; ";
            strHTML += "\n      mso-header-margin:.5in; ";
            strHTML += "\n 	mso-footer-margin:.5in;} ";
            strHTML += "\n tr ";
            strHTML += "\n 	{mso-height-source:auto;} ";
            strHTML += "\n col ";
            strHTML += "\n 	{mso-width-source:auto;} ";
            strHTML += "\n br ";
            strHTML += "\n 	{mso-data-placement:same-cell;} ";
            strHTML += "\n .style0 ";
            strHTML += "\n 	{mso-number-format:General; ";
            strHTML += "\n 	text-align:general; ";
            strHTML += "\n 	vertical-align:bottom; ";
            strHTML += "\n 	white-space:nowrap; ";
            strHTML += "\n 	mso-rotate:0; ";
            strHTML += "\n 	mso-background-source:auto; ";
            strHTML += "\n 	mso-pattern:auto; ";
            strHTML += "\n 	color:windowtext; ";
            strHTML += "\n 	font-size:10.0pt; ";
            strHTML += "\n 	font-weight:400; ";
            strHTML += "\n 	font-style:normal; ";
            strHTML += "\n 	text-decoration:none; ";
            strHTML += "\n 	font-family:Arial; ";
            strHTML += "\n 	mso-generic-font-family:auto; ";
            strHTML += "\n 	mso-font-charset:0; ";
            strHTML += "\n 	border:none; ";
            strHTML += "\n 	mso-protection:locked visible; ";
            strHTML += "\n 	mso-style-name:Normal; ";
            strHTML += "\n 	mso-style-id:0;} ";
            strHTML += "\n td ";
            strHTML += "\n 	{mso-style-parent:style0; ";
            strHTML += "\n 	padding-top:1px; ";
            strHTML += "\n 	padding-right:1px; ";
            strHTML += "\n 	padding-left:1px; ";
            strHTML += "\n 	mso-ignore:padding; ";
            strHTML += "\n 	color:windowtext; ";
            strHTML += "\n 	font-size:10.0pt; ";
            strHTML += "\n 	font-weight:400; ";
            strHTML += "\n 	font-style:normal; ";
            strHTML += "\n 	text-decoration:none; ";
            strHTML += "\n 	font-family:Arial; ";
            strHTML += "\n 	mso-generic-font-family:auto; ";
            strHTML += "\n 	mso-font-charset:0; ";
            strHTML += "\n 	mso-number-format:General; ";
            strHTML += "\n 	text-align:general; ";
            strHTML += "\n 	vertical-align:bottom; ";
            strHTML += "\n 	border:none; ";
            strHTML += "\n 	mso-background-source:auto; ";
            strHTML += "\n 	mso-pattern:auto; ";
            strHTML += "\n 	mso-protection:locked visible; ";
            strHTML += "\n 	white-space:nowrap; ";
            strHTML += "\n 	mso-rotate:0;} ";
            strHTML += "\n .xl23 ";
            strHTML += "\n 	{mso-style-parent:style0; ";
            strHTML += "\n 		font-weight:1600; ";
            strHTML += "\n 		font-family:Arial, sans-serif; ";
            strHTML += "\n 		mso-font-charset:0; ";
            strHTML += "\n 		mso-pattern:auto none;} ";
            strHTML += "\n 	text-align:center;} ";
            strHTML += "\n .xl24 ";
            strHTML += "\n 	{mso-style-parent:style0; ";
            strHTML += "\n 	    color: white; ";
            strHTML += "\n 		font-weight:1000; ";
            strHTML += "\n 		font-family:Arial, sans-serif; ";
            strHTML += "\n 		mso-font-charset:0; ";
            strHTML += "\n 		text-align:center; ";
            strHTML += "\n 		background:Black; ";
            strHTML += "\n 		mso-pattern:auto none;} ";
            strHTML += "\n 	text-align:center;} ";
            strHTML += "\n 	.xl25 ";
            strHTML += "\n 	{	font-family:Arial, sans-serif; ";
            strHTML += "\n 		mso-font-charset:0; ";
            strHTML += "\n 		text-align:center; ";
            strHTML += "\n 		mso-pattern:auto none;} ";
            strHTML += "\n 	.xl26 ";
            strHTML += "\n 		{mso-style-parent:style0; ";
            strHTML += "\n 		mso-pattern:auto none;} ";
            strHTML += "\n --> ";
            strHTML += "\n </style> ";
            strHTML += "\n <!--[if gte mso 9]><xml> ";
            strHTML += "\n  <x:ExcelWorkbook> ";
            strHTML += "\n   <x:ExcelWorksheets> ";
            strHTML += "\n    <x:ExcelWorksheet> ";
            strHTML += "\n     <x:Name>Sheet1</x:Name> ";
            strHTML += "\n     <x:WorksheetOptions> ";
            strHTML += "\n      <x:Selected/> ";
            strHTML += "\n      <x:Panes> ";
            strHTML += "\n       <x:Pane> ";
            strHTML += "\n        <x:Number>3</x:Number> ";
            strHTML += "\n        <x:ActiveRow>2</x:ActiveRow> ";
            strHTML += "\n        <x:ActiveCol>3</x:ActiveCol> ";
            strHTML += "\n       </x:Pane> ";
            strHTML += "\n      </x:Panes> ";
            strHTML += "\n      <x:ProtectContents>False</x:ProtectContents> ";
            strHTML += "\n      <x:ProtectObjects>False</x:ProtectObjects> ";
            strHTML += "\n      <x:ProtectScenarios>False</x:ProtectScenarios> ";
            strHTML += "\n     </x:WorksheetOptions> ";
            strHTML += "\n    </x:ExcelWorksheet> ";
            strHTML += "\n    <x:ExcelWorksheet> ";
            strHTML += "\n     <x:Name>Sheet2</x:Name> ";
            strHTML += "\n     <x:WorksheetOptions> ";
            strHTML += "\n      <x:ProtectContents>False</x:ProtectContents> ";
            strHTML += "\n      <x:ProtectObjects>False</x:ProtectObjects> ";
            strHTML += "\n      <x:ProtectScenarios>False</x:ProtectScenarios> ";
            strHTML += "\n     </x:WorksheetOptions> ";
            strHTML += "\n    </x:ExcelWorksheet> ";
            strHTML += "\n    <x:ExcelWorksheet> ";
            strHTML += "\n     <x:Name>Sheet3</x:Name> ";
            strHTML += "\n     <x:WorksheetOptions> ";
            strHTML += "\n      <x:ProtectContents>False</x:ProtectContents> ";
            strHTML += "\n      <x:ProtectObjects>False</x:ProtectObjects> ";
            strHTML += "\n      <x:ProtectScenarios>False</x:ProtectScenarios> ";
            strHTML += "\n     </x:WorksheetOptions> ";
            strHTML += "\n    </x:ExcelWorksheet> ";
            strHTML += "\n   </x:ExcelWorksheets> ";
            strHTML += "\n   <x:WindowHeight>9300</x:WindowHeight> ";
            strHTML += "\n   <x:WindowWidth>15135</x:WindowWidth> ";
            strHTML += "\n   <x:WindowTopX>120</x:WindowTopX> ";
            strHTML += "\n   <x:WindowTopY>120</x:WindowTopY> ";
            strHTML += "\n   <x:AcceptLabelsInFormulas/> ";
            strHTML += "\n   <x:ProtectStructure>False</x:ProtectStructure> ";
            strHTML += "\n   <x:ProtectWindows>False</x:ProtectWindows> ";
            strHTML += "\n  </x:ExcelWorkbook> ";
            strHTML += "\n </xml><![endif]--> ";
            strHTML += "\n </head> ";
            strHTML += "\n <body link=blue vlink=purple> ";
            strHTML += "\n <table x:str border=0 cellpadding=0 cellspacing=0 width=640 style='border-collapse: ";
            strHTML += "\n  collapse;table-layout:fixed;width:100%'> ";
            strHTML += "\n  <col span=10 style='width:100%'>";
            strHTML += "\n     <tr>";
            strHTML += "\n          <td class=xl23 colspan=10><span class=\"cssTitleReport2\">Báo cáo tỷ lệ các Level</span></td>";
            strHTML += "\n    </tr>        ";
            strHTML += "\n                <tr class=\"cssGridHeader\"> ";
            strHTML += "\n                    <td align=\"center\" style=\"width:28%;\" ><span class=\"cssTitleReport\">Level (LX/LY)</span></td>";
            strHTML += "\n                    <td align=\"center\" style=\"width:8%;\"><span class=\"cssTitleReport\">L1</span></td>";
            strHTML += "\n                    <td align=\"center\" style=\"width:8%;\"><span class=\"cssTitleReport\">L2/L1</span></td>";
            strHTML += "\n                    <td align=\"center\" style=\"width:8%;\"><span class=\"cssTitleReport\">L3/L2</span></td>";
            strHTML += "\n                    <td align=\"center\" style=\"width:8%;\"><span class=\"cssTitleReport\">L4/L3</span></td>";
            strHTML += "\n                    <td align=\"center\" style=\"width:8%;\"><span class=\"cssTitleReport\">L5A/L4</span></td>";
            strHTML += "\n                    <td align=\"center\" style=\"width:8%;\"><span class=\"cssTitleReport\">L5B/L5A</span></td>";
            strHTML += "\n                    <td align=\"center\" style=\"width:8%;\"><span class=\"cssTitleReport\">L6/L5B</span></td>";
            strHTML += "\n                    <td align=\"center\" style=\"width:8%;\"><span class=\"cssTitleReport\">L7/L6</span></td>";
            strHTML += "\n                    <td align=\"center\" style=\"width:8%;\"><span class=\"cssTitleReport\">L8/L7</span></td>";
            strHTML += "\n                </tr>";
            strHTML += "\n                    <tr class=\"cssGridCell\">";
            strHTML += "\n                        <td align=\"left\" style=\"padding-left:10px;\"><span class=\"cssTitleReport\">LX/LY (%)</span></td>";
            strHTML += "\n                        <td align=\"center\" ><span class=\"cssLabel\">100%</span></td>";
            strHTML += "\n                        <td align=\"center\" ><span class=\"cssLabel\">" + intL21.ToString() + "%</span></td>";
            strHTML += "\n                        <td align=\"center\" ><span class=\"cssLabel\">" + intL32.ToString() + "%</span></td>";
            strHTML += "\n                        <td align=\"center\" ><span class=\"cssLabel\">" + intL43.ToString() + "%</span></td>";
            strHTML += "\n                        <td align=\"center\" ><span class=\"cssLabel\">" + intL5A4.ToString() + "%</span></td>";
            strHTML += "\n                        <td align=\"center\" ><span class=\"cssLabel\">" + intL5B5A.ToString() + "%</span></td>";
            strHTML += "\n                        <td align=\"center\" ><span class=\"cssLabel\">" + intL65B.ToString() + "%</span></td>";
            strHTML += "\n                        <td align=\"center\" ><span class=\"cssLabel\">" + intL76.ToString() + "%</span></td>";
            strHTML += "\n                        <td align=\"center\" ><span class=\"cssLabel\">" + intL87.ToString() + "%</span></td>";
            strHTML += "\n                    </tr>";
            strHTML += "\n                    <tr class=\"cssGridAlterCell\">";
            strHTML += "\n                        <td align=\"left\" style=\"padding-left:10px;\"><span class=\"cssTitleReport\">Số lượng LX (Học sinh)</span></td>";
            strHTML += "\n                        <td align=\"center\" ><span class=\"cssLabel\">" + dr["Level1"].ToString() + "</span></td>";
            strHTML += "\n                        <td align=\"center\" ><span class=\"cssLabel\">" + dr["Level2"].ToString() + "</span></td>";
            strHTML += "\n                        <td align=\"center\" ><span class=\"cssLabel\">" + dr["Level3"].ToString() + "</span></td>";
            strHTML += "\n                        <td align=\"center\" ><span class=\"cssLabel\">" + dr["Level4"].ToString() + "</span></td>";
            strHTML += "\n                        <td align=\"center\" ><span class=\"cssLabel\">" + dr["Level5a"].ToString() + "</span></td>";
            strHTML += "\n                        <td align=\"center\" ><span class=\"cssLabel\">" + dr["Level5b"].ToString() + "</span></td>";
            strHTML += "\n                        <td align=\"center\" ><span class=\"cssLabel\">" + dr["Level6"].ToString() + "</span></td>";
            strHTML += "\n                        <td align=\"center\" ><span class=\"cssLabel\">" + dr["Level7"].ToString() + "</span></td>";
            strHTML += "\n                        <td align=\"center\" ><span class=\"cssLabel\">" + dr["Level8"].ToString() + "</span></td>";
            strHTML += "\n                    </tr>";
            strHTML += "\n </table> ";
            strHTML += "\n </body> ";
            strHTML += "\n </html> ";
  
            return strHTML;
        }
        catch
        {
            return "";
        }
    }

    private string loadReport1A_report()
    {
        try
        {
            string strHTML = "<html xmlns:o=\"urn:schemas-microsoft-com:office:office\" ";
            strHTML += "\n xmlns:x=\"urn:schemas-microsoft-com:office:excel\" ";
            strHTML += "\n xmlns=\"http://www.w3.org/TR/REC-html40\"> ";
            strHTML += "\n <head> ";
            strHTML += "\n <meta http-equiv=Content-Type content=\"text/html; charset=UTF-8\"> ";
            strHTML += "\n <meta name=ProgId content=Excel.Sheet> ";
            strHTML += "\n <meta name=Generator content=\"Microsoft Excel 11\"> ";
            strHTML += "\n <link rel=File-List ";
            strHTML += "\n href=\"New%20Microsoft%20Excel%20Worksheet_files/filelist.xml\"> ";
            strHTML += "\n <link rel=Edit-Time-Data ";
            strHTML += "\n href=\"New%20Microsoft%20Excel%20Worksheet_files/editdata.mso\"> ";
            strHTML += "\n <link rel=OLE-Object-Data ";
            strHTML += "\n href=\"New%20Microsoft%20Excel%20Worksheet_files/oledata.mso\"> ";
            strHTML += "\n <!--[if gte mso 9]><xml> ";
            strHTML += "\n  <o:DocumentProperties> ";
            strHTML += "\n   <o:LastAuthor>User</o:LastAuthor> ";
            strHTML += "\n   <o:Created>1996-10-14T23:33:28Z</o:Created> ";
            strHTML += "\n   <o:LastSaved>2009-06-04T09:49:20Z</o:LastSaved> ";
            strHTML += "\n   <o:Version>11.5606</o:Version> ";
            strHTML += "\n </o:DocumentProperties> ";
            strHTML += "\n </xml><![endif]--> ";
            strHTML += "\n <style> ";
            strHTML += "\n <!--table ";
            strHTML += "\n      {mso-displayed-decimal-separator:\"\\.\"; ";
            strHTML += "\n      mso-displayed-thousand-separator:\"\\,\";} ";
            strHTML += "\n @page ";
            strHTML += "\n      {margin:1.0in .75in 1.0in .75in; ";
            strHTML += "\n      mso-header-margin:.5in; ";
            strHTML += "\n 	mso-footer-margin:.5in;} ";
            strHTML += "\n tr ";
            strHTML += "\n 	{mso-height-source:auto;} ";
            strHTML += "\n col ";
            strHTML += "\n 	{mso-width-source:auto;} ";
            strHTML += "\n br ";
            strHTML += "\n 	{mso-data-placement:same-cell;} ";
            strHTML += "\n .style0 ";
            strHTML += "\n 	{mso-number-format:General; ";
            strHTML += "\n 	text-align:general; ";
            strHTML += "\n 	vertical-align:bottom; ";
            strHTML += "\n 	white-space:nowrap; ";
            strHTML += "\n 	mso-rotate:0; ";
            strHTML += "\n 	mso-background-source:auto; ";
            strHTML += "\n 	mso-pattern:auto; ";
            strHTML += "\n 	color:windowtext; ";
            strHTML += "\n 	font-size:10.0pt; ";
            strHTML += "\n 	font-weight:400; ";
            strHTML += "\n 	font-style:normal; ";
            strHTML += "\n 	text-decoration:none; ";
            strHTML += "\n 	font-family:Arial; ";
            strHTML += "\n 	mso-generic-font-family:auto; ";
            strHTML += "\n 	mso-font-charset:0; ";
            strHTML += "\n 	border:none; ";
            strHTML += "\n 	mso-protection:locked visible; ";
            strHTML += "\n 	mso-style-name:Normal; ";
            strHTML += "\n 	mso-style-id:0;} ";
            strHTML += "\n td ";
            strHTML += "\n 	{mso-style-parent:style0; ";
            strHTML += "\n 	padding-top:1px; ";
            strHTML += "\n 	padding-right:1px; ";
            strHTML += "\n 	padding-left:1px; ";
            strHTML += "\n 	mso-ignore:padding; ";
            strHTML += "\n 	color:windowtext; ";
            strHTML += "\n 	font-size:10.0pt; ";
            strHTML += "\n 	font-weight:400; ";
            strHTML += "\n 	font-style:normal; ";
            strHTML += "\n 	text-decoration:none; ";
            strHTML += "\n 	font-family:Arial; ";
            strHTML += "\n 	mso-generic-font-family:auto; ";
            strHTML += "\n 	mso-font-charset:0; ";
            strHTML += "\n 	mso-number-format:General; ";
            strHTML += "\n 	text-align:general; ";
            strHTML += "\n 	vertical-align:bottom; ";
            strHTML += "\n 	border:none; ";
            strHTML += "\n 	mso-background-source:auto; ";
            strHTML += "\n 	mso-pattern:auto; ";
            strHTML += "\n 	mso-protection:locked visible; ";
            strHTML += "\n 	white-space:nowrap; ";
            strHTML += "\n 	mso-rotate:0;} ";
            strHTML += "\n .xl23 ";
            strHTML += "\n 	{mso-style-parent:style0; ";
            strHTML += "\n 		font-weight:1600; ";
            strHTML += "\n 		font-family:Arial, sans-serif; ";
            strHTML += "\n 		mso-font-charset:0; ";
            strHTML += "\n 		mso-pattern:auto none;} ";
            strHTML += "\n 	text-align:center;} ";
            strHTML += "\n .xl24 ";
            strHTML += "\n 	{mso-style-parent:style0; ";
            strHTML += "\n 	    color: white; ";
            strHTML += "\n 		font-weight:1000; ";
            strHTML += "\n 		font-family:Arial, sans-serif; ";
            strHTML += "\n 		mso-font-charset:0; ";
            strHTML += "\n 		text-align:center; ";
            strHTML += "\n 		background:Black; ";
            strHTML += "\n 		mso-pattern:auto none;} ";
            strHTML += "\n 	text-align:center;} ";
            strHTML += "\n 	.xl25 ";
            strHTML += "\n 	{	font-family:Arial, sans-serif; ";
            strHTML += "\n 		mso-font-charset:0; ";
            strHTML += "\n 		text-align:center; ";
            strHTML += "\n 		mso-pattern:auto none;} ";
            strHTML += "\n 	.xl26 ";
            strHTML += "\n 		{mso-style-parent:style0; ";
            strHTML += "\n 		mso-pattern:auto none;} ";
            strHTML += "\n --> ";
            strHTML += "\n </style> ";
            strHTML += "\n <!--[if gte mso 9]><xml> ";
            strHTML += "\n  <x:ExcelWorkbook> ";
            strHTML += "\n   <x:ExcelWorksheets> ";
            strHTML += "\n    <x:ExcelWorksheet> ";
            strHTML += "\n     <x:Name>Sheet1</x:Name> ";
            strHTML += "\n     <x:WorksheetOptions> ";
            strHTML += "\n      <x:Selected/> ";
            strHTML += "\n      <x:Panes> ";
            strHTML += "\n       <x:Pane> ";
            strHTML += "\n        <x:Number>3</x:Number> ";
            strHTML += "\n        <x:ActiveRow>2</x:ActiveRow> ";
            strHTML += "\n        <x:ActiveCol>3</x:ActiveCol> ";
            strHTML += "\n       </x:Pane> ";
            strHTML += "\n      </x:Panes> ";
            strHTML += "\n      <x:ProtectContents>False</x:ProtectContents> ";
            strHTML += "\n      <x:ProtectObjects>False</x:ProtectObjects> ";
            strHTML += "\n      <x:ProtectScenarios>False</x:ProtectScenarios> ";
            strHTML += "\n     </x:WorksheetOptions> ";
            strHTML += "\n    </x:ExcelWorksheet> ";
            strHTML += "\n    <x:ExcelWorksheet> ";
            strHTML += "\n     <x:Name>Sheet2</x:Name> ";
            strHTML += "\n     <x:WorksheetOptions> ";
            strHTML += "\n      <x:ProtectContents>False</x:ProtectContents> ";
            strHTML += "\n      <x:ProtectObjects>False</x:ProtectObjects> ";
            strHTML += "\n      <x:ProtectScenarios>False</x:ProtectScenarios> ";
            strHTML += "\n     </x:WorksheetOptions> ";
            strHTML += "\n    </x:ExcelWorksheet> ";
            strHTML += "\n    <x:ExcelWorksheet> ";
            strHTML += "\n     <x:Name>Sheet3</x:Name> ";
            strHTML += "\n     <x:WorksheetOptions> ";
            strHTML += "\n      <x:ProtectContents>False</x:ProtectContents> ";
            strHTML += "\n      <x:ProtectObjects>False</x:ProtectObjects> ";
            strHTML += "\n      <x:ProtectScenarios>False</x:ProtectScenarios> ";
            strHTML += "\n     </x:WorksheetOptions> ";
            strHTML += "\n    </x:ExcelWorksheet> ";
            strHTML += "\n   </x:ExcelWorksheets> ";
            strHTML += "\n   <x:WindowHeight>9300</x:WindowHeight> ";
            strHTML += "\n   <x:WindowWidth>15135</x:WindowWidth> ";
            strHTML += "\n   <x:WindowTopX>120</x:WindowTopX> ";
            strHTML += "\n   <x:WindowTopY>120</x:WindowTopY> ";
            strHTML += "\n   <x:AcceptLabelsInFormulas/> ";
            strHTML += "\n   <x:ProtectStructure>False</x:ProtectStructure> ";
            strHTML += "\n   <x:ProtectWindows>False</x:ProtectWindows> ";
            strHTML += "\n  </x:ExcelWorkbook> ";
            strHTML += "\n </xml><![endif]--> ";
            strHTML += "\n </head> ";

            strHTML += "\n <body link=blue vlink=purple> ";

            strHTML += loadReport1A();
            
            strHTML += "\n </body> ";
            strHTML += "\n </html> ";

            return strHTML;
        }
        catch
        {
            return "";
        }
    }

    private string loadReport1A_report_TongHop()
    {
        try
        {
            string strHTML = "<html xmlns:o=\"urn:schemas-microsoft-com:office:office\" ";
            strHTML += "\n xmlns:x=\"urn:schemas-microsoft-com:office:excel\" ";
            strHTML += "\n xmlns=\"http://www.w3.org/TR/REC-html40\"> ";
            strHTML += "\n <head> ";
            strHTML += "\n <meta http-equiv=Content-Type content=\"text/html; charset=UTF-8\"> ";
            strHTML += "\n <meta name=ProgId content=Excel.Sheet> ";
            strHTML += "\n <meta name=Generator content=\"Microsoft Excel 11\"> ";
            strHTML += "\n <link rel=File-List ";
            strHTML += "\n href=\"New%20Microsoft%20Excel%20Worksheet_files/filelist.xml\"> ";
            strHTML += "\n <link rel=Edit-Time-Data ";
            strHTML += "\n href=\"New%20Microsoft%20Excel%20Worksheet_files/editdata.mso\"> ";
            strHTML += "\n <link rel=OLE-Object-Data ";
            strHTML += "\n href=\"New%20Microsoft%20Excel%20Worksheet_files/oledata.mso\"> ";
            strHTML += "\n <!--[if gte mso 9]><xml> ";
            strHTML += "\n  <o:DocumentProperties> ";
            strHTML += "\n   <o:LastAuthor>User</o:LastAuthor> ";
            strHTML += "\n   <o:Created>1996-10-14T23:33:28Z</o:Created> ";
            strHTML += "\n   <o:LastSaved>2009-06-04T09:49:20Z</o:LastSaved> ";
            strHTML += "\n   <o:Version>11.5606</o:Version> ";
            strHTML += "\n </o:DocumentProperties> ";
            strHTML += "\n </xml><![endif]--> ";
            strHTML += "\n <style> ";
            strHTML += "\n <!--table ";
            strHTML += "\n      {mso-displayed-decimal-separator:\"\\.\"; ";
            strHTML += "\n      mso-displayed-thousand-separator:\"\\,\";} ";
            strHTML += "\n @page ";
            strHTML += "\n      {margin:1.0in .75in 1.0in .75in; ";
            strHTML += "\n      mso-header-margin:.5in; ";
            strHTML += "\n 	mso-footer-margin:.5in;} ";
            strHTML += "\n tr ";
            strHTML += "\n 	{mso-height-source:auto;} ";
            strHTML += "\n col ";
            strHTML += "\n 	{mso-width-source:auto;} ";
            strHTML += "\n br ";
            strHTML += "\n 	{mso-data-placement:same-cell;} ";
            strHTML += "\n .style0 ";
            strHTML += "\n 	{mso-number-format:General; ";
            strHTML += "\n 	text-align:general; ";
            strHTML += "\n 	vertical-align:bottom; ";
            strHTML += "\n 	white-space:nowrap; ";
            strHTML += "\n 	mso-rotate:0; ";
            strHTML += "\n 	mso-background-source:auto; ";
            strHTML += "\n 	mso-pattern:auto; ";
            strHTML += "\n 	color:windowtext; ";
            strHTML += "\n 	font-size:10.0pt; ";
            strHTML += "\n 	font-weight:400; ";
            strHTML += "\n 	font-style:normal; ";
            strHTML += "\n 	text-decoration:none; ";
            strHTML += "\n 	font-family:Arial; ";
            strHTML += "\n 	mso-generic-font-family:auto; ";
            strHTML += "\n 	mso-font-charset:0; ";
            strHTML += "\n 	border:none; ";
            strHTML += "\n 	mso-protection:locked visible; ";
            strHTML += "\n 	mso-style-name:Normal; ";
            strHTML += "\n 	mso-style-id:0;} ";
            strHTML += "\n td ";
            strHTML += "\n 	{mso-style-parent:style0; ";
            strHTML += "\n 	padding-top:1px; ";
            strHTML += "\n 	padding-right:1px; ";
            strHTML += "\n 	padding-left:1px; ";
            strHTML += "\n 	mso-ignore:padding; ";
            strHTML += "\n 	color:windowtext; ";
            strHTML += "\n 	font-size:10.0pt; ";
            strHTML += "\n 	font-weight:400; ";
            strHTML += "\n 	font-style:normal; ";
            strHTML += "\n 	text-decoration:none; ";
            strHTML += "\n 	font-family:Arial; ";
            strHTML += "\n 	mso-generic-font-family:auto; ";
            strHTML += "\n 	mso-font-charset:0; ";
            strHTML += "\n 	mso-number-format:General; ";
            strHTML += "\n 	text-align:general; ";
            strHTML += "\n 	vertical-align:bottom; ";
            strHTML += "\n 	border:none; ";
            strHTML += "\n 	mso-background-source:auto; ";
            strHTML += "\n 	mso-pattern:auto; ";
            strHTML += "\n 	mso-protection:locked visible; ";
            strHTML += "\n 	white-space:nowrap; ";
            strHTML += "\n 	mso-rotate:0;} ";
            strHTML += "\n .xl23 ";
            strHTML += "\n 	{mso-style-parent:style0; ";
            strHTML += "\n 		font-weight:1600; ";
            strHTML += "\n 		font-family:Arial, sans-serif; ";
            strHTML += "\n 		mso-font-charset:0; ";
            strHTML += "\n 		mso-pattern:auto none;} ";
            strHTML += "\n 	text-align:center;} ";
            strHTML += "\n .xl24 ";
            strHTML += "\n 	{mso-style-parent:style0; ";
            strHTML += "\n 	    color: white; ";
            strHTML += "\n 		font-weight:1000; ";
            strHTML += "\n 		font-family:Arial, sans-serif; ";
            strHTML += "\n 		mso-font-charset:0; ";
            strHTML += "\n 		text-align:center; ";
            strHTML += "\n 		background:Black; ";
            strHTML += "\n 		mso-pattern:auto none;} ";
            strHTML += "\n 	text-align:center;} ";
            strHTML += "\n 	.xl25 ";
            strHTML += "\n 	{	font-family:Arial, sans-serif; ";
            strHTML += "\n 		mso-font-charset:0; ";
            strHTML += "\n 		text-align:center; ";
            strHTML += "\n 		mso-pattern:auto none;} ";
            strHTML += "\n 	.xl26 ";
            strHTML += "\n 		{mso-style-parent:style0; ";
            strHTML += "\n 		mso-pattern:auto none;} ";
            strHTML += "\n --> ";
            strHTML += "\n </style> ";
            strHTML += "\n <!--[if gte mso 9]><xml> ";
            strHTML += "\n  <x:ExcelWorkbook> ";
            strHTML += "\n   <x:ExcelWorksheets> ";
            strHTML += "\n    <x:ExcelWorksheet> ";
            strHTML += "\n     <x:Name>Sheet1</x:Name> ";
            strHTML += "\n     <x:WorksheetOptions> ";
            strHTML += "\n      <x:Selected/> ";
            strHTML += "\n      <x:Panes> ";
            strHTML += "\n       <x:Pane> ";
            strHTML += "\n        <x:Number>3</x:Number> ";
            strHTML += "\n        <x:ActiveRow>2</x:ActiveRow> ";
            strHTML += "\n        <x:ActiveCol>3</x:ActiveCol> ";
            strHTML += "\n       </x:Pane> ";
            strHTML += "\n      </x:Panes> ";
            strHTML += "\n      <x:ProtectContents>False</x:ProtectContents> ";
            strHTML += "\n      <x:ProtectObjects>False</x:ProtectObjects> ";
            strHTML += "\n      <x:ProtectScenarios>False</x:ProtectScenarios> ";
            strHTML += "\n     </x:WorksheetOptions> ";
            strHTML += "\n    </x:ExcelWorksheet> ";
            strHTML += "\n    <x:ExcelWorksheet> ";
            strHTML += "\n     <x:Name>Sheet2</x:Name> ";
            strHTML += "\n     <x:WorksheetOptions> ";
            strHTML += "\n      <x:ProtectContents>False</x:ProtectContents> ";
            strHTML += "\n      <x:ProtectObjects>False</x:ProtectObjects> ";
            strHTML += "\n      <x:ProtectScenarios>False</x:ProtectScenarios> ";
            strHTML += "\n     </x:WorksheetOptions> ";
            strHTML += "\n    </x:ExcelWorksheet> ";
            strHTML += "\n    <x:ExcelWorksheet> ";
            strHTML += "\n     <x:Name>Sheet3</x:Name> ";
            strHTML += "\n     <x:WorksheetOptions> ";
            strHTML += "\n      <x:ProtectContents>False</x:ProtectContents> ";
            strHTML += "\n      <x:ProtectObjects>False</x:ProtectObjects> ";
            strHTML += "\n      <x:ProtectScenarios>False</x:ProtectScenarios> ";
            strHTML += "\n     </x:WorksheetOptions> ";
            strHTML += "\n    </x:ExcelWorksheet> ";
            strHTML += "\n   </x:ExcelWorksheets> ";
            strHTML += "\n   <x:WindowHeight>9300</x:WindowHeight> ";
            strHTML += "\n   <x:WindowWidth>15135</x:WindowWidth> ";
            strHTML += "\n   <x:WindowTopX>120</x:WindowTopX> ";
            strHTML += "\n   <x:WindowTopY>120</x:WindowTopY> ";
            strHTML += "\n   <x:AcceptLabelsInFormulas/> ";
            strHTML += "\n   <x:ProtectStructure>False</x:ProtectStructure> ";
            strHTML += "\n   <x:ProtectWindows>False</x:ProtectWindows> ";
            strHTML += "\n  </x:ExcelWorkbook> ";
            strHTML += "\n </xml><![endif]--> ";
            strHTML += "\n </head> ";

            strHTML += "\n <body link=blue vlink=purple> ";

            strHTML += loadReport1A();

            strHTML += loadReport2A();

            strHTML += "\n </body> ";
            strHTML += "\n </html> ";

            return strHTML;
        }
        catch
        {
            return "";
        }
    }

    private string loadReport2A_report()
    {
        try
        {
            string strHTML = "<html xmlns:o=\"urn:schemas-microsoft-com:office:office\" ";
            strHTML += "\n xmlns:x=\"urn:schemas-microsoft-com:office:excel\" ";
            strHTML += "\n xmlns=\"http://www.w3.org/TR/REC-html40\"> ";
            strHTML += "\n <head> ";
            strHTML += "\n <meta http-equiv=Content-Type content=\"text/html; charset=UTF-8\"> ";
            strHTML += "\n <meta name=ProgId content=Excel.Sheet> ";
            strHTML += "\n <meta name=Generator content=\"Microsoft Excel 11\"> ";
            strHTML += "\n <link rel=File-List ";
            strHTML += "\n href=\"New%20Microsoft%20Excel%20Worksheet_files/filelist.xml\"> ";
            strHTML += "\n <link rel=Edit-Time-Data ";
            strHTML += "\n href=\"New%20Microsoft%20Excel%20Worksheet_files/editdata.mso\"> ";
            strHTML += "\n <link rel=OLE-Object-Data ";
            strHTML += "\n href=\"New%20Microsoft%20Excel%20Worksheet_files/oledata.mso\"> ";
            strHTML += "\n <!--[if gte mso 9]><xml> ";
            strHTML += "\n  <o:DocumentProperties> ";
            strHTML += "\n   <o:LastAuthor>User</o:LastAuthor> ";
            strHTML += "\n   <o:Created>1996-10-14T23:33:28Z</o:Created> ";
            strHTML += "\n   <o:LastSaved>2009-06-04T09:49:20Z</o:LastSaved> ";
            strHTML += "\n   <o:Version>11.5606</o:Version> ";
            strHTML += "\n </o:DocumentProperties> ";
            strHTML += "\n </xml><![endif]--> ";
            strHTML += "\n <style> ";
            strHTML += "\n <!--table ";
            strHTML += "\n      {mso-displayed-decimal-separator:\"\\.\"; ";
            strHTML += "\n      mso-displayed-thousand-separator:\"\\,\";} ";
            strHTML += "\n @page ";
            strHTML += "\n      {margin:1.0in .75in 1.0in .75in; ";
            strHTML += "\n      mso-header-margin:.5in; ";
            strHTML += "\n 	mso-footer-margin:.5in;} ";
            strHTML += "\n tr ";
            strHTML += "\n 	{mso-height-source:auto;} ";
            strHTML += "\n col ";
            strHTML += "\n 	{mso-width-source:auto;} ";
            strHTML += "\n br ";
            strHTML += "\n 	{mso-data-placement:same-cell;} ";
            strHTML += "\n .style0 ";
            strHTML += "\n 	{mso-number-format:General; ";
            strHTML += "\n 	text-align:general; ";
            strHTML += "\n 	vertical-align:bottom; ";
            strHTML += "\n 	white-space:nowrap; ";
            strHTML += "\n 	mso-rotate:0; ";
            strHTML += "\n 	mso-background-source:auto; ";
            strHTML += "\n 	mso-pattern:auto; ";
            strHTML += "\n 	color:windowtext; ";
            strHTML += "\n 	font-size:10.0pt; ";
            strHTML += "\n 	font-weight:400; ";
            strHTML += "\n 	font-style:normal; ";
            strHTML += "\n 	text-decoration:none; ";
            strHTML += "\n 	font-family:Arial; ";
            strHTML += "\n 	mso-generic-font-family:auto; ";
            strHTML += "\n 	mso-font-charset:0; ";
            strHTML += "\n 	border:none; ";
            strHTML += "\n 	mso-protection:locked visible; ";
            strHTML += "\n 	mso-style-name:Normal; ";
            strHTML += "\n 	mso-style-id:0;} ";
            strHTML += "\n td ";
            strHTML += "\n 	{mso-style-parent:style0; ";
            strHTML += "\n 	padding-top:1px; ";
            strHTML += "\n 	padding-right:1px; ";
            strHTML += "\n 	padding-left:1px; ";
            strHTML += "\n 	mso-ignore:padding; ";
            strHTML += "\n 	color:windowtext; ";
            strHTML += "\n 	font-size:10.0pt; ";
            strHTML += "\n 	font-weight:400; ";
            strHTML += "\n 	font-style:normal; ";
            strHTML += "\n 	text-decoration:none; ";
            strHTML += "\n 	font-family:Arial; ";
            strHTML += "\n 	mso-generic-font-family:auto; ";
            strHTML += "\n 	mso-font-charset:0; ";
            strHTML += "\n 	mso-number-format:General; ";
            strHTML += "\n 	text-align:general; ";
            strHTML += "\n 	vertical-align:bottom; ";
            strHTML += "\n 	border:none; ";
            strHTML += "\n 	mso-background-source:auto; ";
            strHTML += "\n 	mso-pattern:auto; ";
            strHTML += "\n 	mso-protection:locked visible; ";
            strHTML += "\n 	white-space:nowrap; ";
            strHTML += "\n 	mso-rotate:0;} ";
            strHTML += "\n .xl23 ";
            strHTML += "\n 	{mso-style-parent:style0; ";
            strHTML += "\n 		font-weight:1600; ";
            strHTML += "\n 		font-family:Arial, sans-serif; ";
            strHTML += "\n 		mso-font-charset:0; ";
            strHTML += "\n 		mso-pattern:auto none;} ";
            strHTML += "\n 	text-align:center;} ";
            strHTML += "\n .xl24 ";
            strHTML += "\n 	{mso-style-parent:style0; ";
            strHTML += "\n 	    color: white; ";
            strHTML += "\n 		font-weight:1000; ";
            strHTML += "\n 		font-family:Arial, sans-serif; ";
            strHTML += "\n 		mso-font-charset:0; ";
            strHTML += "\n 		text-align:center; ";
            strHTML += "\n 		background:Black; ";
            strHTML += "\n 		mso-pattern:auto none;} ";
            strHTML += "\n 	text-align:center;} ";
            strHTML += "\n 	.xl25 ";
            strHTML += "\n 	{	font-family:Arial, sans-serif; ";
            strHTML += "\n 		mso-font-charset:0; ";
            strHTML += "\n 		text-align:center; ";
            strHTML += "\n 		mso-pattern:auto none;} ";
            strHTML += "\n 	.xl26 ";
            strHTML += "\n 		{mso-style-parent:style0; ";
            strHTML += "\n 		mso-pattern:auto none;} ";
            strHTML += "\n --> ";
            strHTML += "\n </style> ";
            strHTML += "\n <!--[if gte mso 9]><xml> ";
            strHTML += "\n  <x:ExcelWorkbook> ";
            strHTML += "\n   <x:ExcelWorksheets> ";
            strHTML += "\n    <x:ExcelWorksheet> ";
            strHTML += "\n     <x:Name>Sheet1</x:Name> ";
            strHTML += "\n     <x:WorksheetOptions> ";
            strHTML += "\n      <x:Selected/> ";
            strHTML += "\n      <x:Panes> ";
            strHTML += "\n       <x:Pane> ";
            strHTML += "\n        <x:Number>3</x:Number> ";
            strHTML += "\n        <x:ActiveRow>2</x:ActiveRow> ";
            strHTML += "\n        <x:ActiveCol>3</x:ActiveCol> ";
            strHTML += "\n       </x:Pane> ";
            strHTML += "\n      </x:Panes> ";
            strHTML += "\n      <x:ProtectContents>False</x:ProtectContents> ";
            strHTML += "\n      <x:ProtectObjects>False</x:ProtectObjects> ";
            strHTML += "\n      <x:ProtectScenarios>False</x:ProtectScenarios> ";
            strHTML += "\n     </x:WorksheetOptions> ";
            strHTML += "\n    </x:ExcelWorksheet> ";
            strHTML += "\n    <x:ExcelWorksheet> ";
            strHTML += "\n     <x:Name>Sheet2</x:Name> ";
            strHTML += "\n     <x:WorksheetOptions> ";
            strHTML += "\n      <x:ProtectContents>False</x:ProtectContents> ";
            strHTML += "\n      <x:ProtectObjects>False</x:ProtectObjects> ";
            strHTML += "\n      <x:ProtectScenarios>False</x:ProtectScenarios> ";
            strHTML += "\n     </x:WorksheetOptions> ";
            strHTML += "\n    </x:ExcelWorksheet> ";
            strHTML += "\n    <x:ExcelWorksheet> ";
            strHTML += "\n     <x:Name>Sheet3</x:Name> ";
            strHTML += "\n     <x:WorksheetOptions> ";
            strHTML += "\n      <x:ProtectContents>False</x:ProtectContents> ";
            strHTML += "\n      <x:ProtectObjects>False</x:ProtectObjects> ";
            strHTML += "\n      <x:ProtectScenarios>False</x:ProtectScenarios> ";
            strHTML += "\n     </x:WorksheetOptions> ";
            strHTML += "\n    </x:ExcelWorksheet> ";
            strHTML += "\n   </x:ExcelWorksheets> ";
            strHTML += "\n   <x:WindowHeight>9300</x:WindowHeight> ";
            strHTML += "\n   <x:WindowWidth>15135</x:WindowWidth> ";
            strHTML += "\n   <x:WindowTopX>120</x:WindowTopX> ";
            strHTML += "\n   <x:WindowTopY>120</x:WindowTopY> ";
            strHTML += "\n   <x:AcceptLabelsInFormulas/> ";
            strHTML += "\n   <x:ProtectStructure>False</x:ProtectStructure> ";
            strHTML += "\n   <x:ProtectWindows>False</x:ProtectWindows> ";
            strHTML += "\n  </x:ExcelWorkbook> ";
            strHTML += "\n </xml><![endif]--> ";
            strHTML += "\n </head> ";
            strHTML += "\n <body link=blue vlink=purple> ";

            strHTML += loadReport2A();

            strHTML += "\n </body> ";
            strHTML += "\n </html> ";

            return strHTML;
        }
        catch
        {
            return "";
        }
    }   

    public void SaveWord(string html, string strNamFile)
    {
		Response.Cache.SetExpires(DateTime.Now.AddSeconds(1));
        Response.Clear();
        Response.AppendHeader("content-disposition", "attachment;filename=" + strNamFile);
        Response.Charset = "";
        Response.Cache.SetCacheability(HttpCacheability.NoCache);
        Response.ContentType = "application/vnd.ms-word";
        this.EnableViewState = false;
        Response.Write("\r\n");
        Response.Write(html);
        Response.End();
    }
    public void SaveExcel(string html, string strNamFile)
    {
		Response.Cache.SetExpires(DateTime.Now.AddSeconds(1));
        Response.Clear();
        Response.AppendHeader("content-disposition", "attachment;filename=" + strNamFile);
        Response.Charset = "";
        Response.Cache.SetCacheability(HttpCacheability.NoCache);
        Response.ContentType = "application/vnd.ms-excel";
        this.EnableViewState = false;
        Response.Write("\r\n");
        Response.Write(html);
        Response.End();
    }
    protected void btnExportFile_Click(object sender, EventArgs e)
    {
        int intCheck = Convert.ToInt32(this.ddlExportFileReport.SelectedValue);
        if (intCheck > 0)
        {
			
            if (intCheck ==1)
            {
                SaveExcel(loadReport1A_report_TongHop(), "Baocaotonghop" + DateTime.Now.Day + "-" + DateTime.Now.Month + "-" + DateTime.Now.Year + ".xls");
            }
            else if (intCheck ==2)
            {
                SaveWord(loadReport1A_report() + loadReport2A_report(), "Baocaotonghop" + DateTime.Now.Day + "-" + DateTime.Now.Month + "-" + DateTime.Now.Year + ".doc");
            }            
            else if (intCheck == 3)
            {
                SaveExcel(loadReport1A_report(), "Baocao1(" + DateTime.Now.Day + "-" + DateTime.Now.Month + "-" + DateTime.Now.Year + ").xls");                
            }
            else if (intCheck == 4)
            {
                SaveWord(loadReport1A_report(), "Baocao1(" + DateTime.Now.Day + "-" + DateTime.Now.Month + "-" + DateTime.Now.Year + ").doc");                
            }
            else if (intCheck == 5)
            {
                SaveExcel(loadReport2A_report(), "Baocao2(" + DateTime.Now.Day + "-" + DateTime.Now.Month + "-" + DateTime.Now.Year + ").xls");
            }
            else if (intCheck == 6)
            {
                SaveWord(loadReport2A_report(), "Baocao2(" + DateTime.Now.Day + "-" + DateTime.Now.Month + "-" + DateTime.Now.Year + ").doc");
            }
        }
        else
        {

        }
    }
    protected void m_cmd_report_Click(object sender, EventArgs e)
    {
        try
        {
            loadReport(Int32.Parse(ddlFileReport.SelectedValue));
        }
        catch
        {
            
            throw;
        }
    }
    protected void m_cbo_nhom_tvts_SelectedIndexChanged(object sender, EventArgs e)
    {
        try
        {
            load_tvts(Int32.Parse(m_cbo_nhom_tvts.SelectedValue));
        }
        catch (Exception)
        {
            
            throw;
        }
    }
}
